Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Mukul
jio
Commits
22f289c5
Commit
22f289c5
authored
7 years ago
by
preetwinder
Committed by
Romain Courteaud
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support multiline string search with the % wildcard
/reviewed-on
nexedi/jio!61
parent
f864e6e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
1 deletion
+45
-1
src/queries/query.js
src/queries/query.js
+1
-1
test/queries/tests.js
test/queries/tests.js
+44
-0
No files found.
src/queries/query.js
View file @
22f289c5
...
...
@@ -415,7 +415,7 @@
return
new
RegExp
(
"
^
"
+
stringEscapeRegexpCharacters
(
string
)
+
"
$
"
);
}
return
new
RegExp
(
"
^
"
+
stringEscapeRegexpCharacters
(
string
)
.
replace
(
regexp_percent
,
'
.
*
'
)
.
replace
(
regexp_percent
,
'
[
\\
s
\\
S]
*
'
)
.
replace
(
regexp_underscore
,
'
.
'
)
+
"
$
"
);
}
...
...
This diff is collapsed.
Click to expand it.
test/queries/tests.js
View file @
22f289c5
...
...
@@ -313,4 +313,48 @@
});
test
(
'
Docs with space, tab, and newline
'
,
function
()
{
var
doc_list
=
[
{
"
identifier
"
:
"
a
"
},
{
"
identifier
"
:
"
a
"
}
];
stop
();
expect
(
3
);
jIO
.
QueryFactory
.
create
(
'
identifier: "%a%"
'
).
exec
(
doc_list
).
then
(
function
(
doc_list
)
{
deepEqual
(
doc_list
,
[
{
"
identifier
"
:
"
a
"
},
{
"
identifier
"
:
"
a
"
}
],
'
Document with space is matched
'
);
doc_list
=
[
{
"
identifier
"
:
"
a
"
},
{
"
identifier
"
:
"
a
\t
"
}
];
return
jIO
.
QueryFactory
.
create
(
'
identifier: "%a%"
'
).
exec
(
doc_list
);
}).
then
(
function
(
doc_list
)
{
deepEqual
(
doc_list
,
[
{
"
identifier
"
:
"
a
"
},
{
"
identifier
"
:
"
a
\t
"
}
],
'
Document with tab is matched
'
);
doc_list
=
[
{
"
identifier
"
:
"
a
"
},
{
"
identifier
"
:
"
a
\n
"
},
{
"
identifier
"
:
"
\n
a
\n
b
\n
c
\n
"
}
];
return
jIO
.
QueryFactory
.
create
(
'
identifier: "%a%"
'
).
exec
(
doc_list
);
}).
then
(
function
(
doc_list
)
{
deepEqual
(
doc_list
,
[
{
"
identifier
"
:
"
a
"
},
{
"
identifier
"
:
"
a
\n
"
},
{
"
identifier
"
:
"
\n
a
\n
b
\n
c
\n
"
}
],
'
Documents with newlines are matched
'
);
}).
always
(
start
);
});
}));
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment