Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Diegodlh
Web2Cit Core
Commits
cca6f19a
Commit
cca6f19a
authored
Mar 04, 2022
by
Diegodlh
Browse files
wrap regular expressions between "/" and use double quoutes to force plain string matching
parent
47e88b01
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/templates/transformation.test.ts
View file @
cca6f19a
...
...
@@ -277,13 +277,20 @@ describe("Match transformation", () => {
expect
(
await
transformation
.
transform
(
input
)).
toEqual
([
"
sub,string
"
]);
});
it
(
"
use
s regular expressions
"
,
async
()
=>
{
it
(
"
support
s regular expressions
between //, including flags
"
,
async
()
=>
{
const
transformation
=
new
MatchTransformation
(
false
);
transformation
.
config
=
"
(sub)?string
"
;
const
input
=
[
"
a
s
ubstring inside a string
"
];
transformation
.
config
=
"
/
(sub)?string
/i
"
;
const
input
=
[
"
a
S
ubstring inside a string
"
];
expect
(
await
transformation
.
transform
(
input
)).
toEqual
([
"
s
ubstring
"
,
"
S
ubstring
"
,
"
string
"
,
]);
});
it
(
"
accepts optional double quotes to force plain string matching
"
,
async
()
=>
{
const
transformation
=
new
MatchTransformation
(
false
);
transformation
.
config
=
'
"/(sub)?string/i"
'
;
const
input
=
[
"
a Substring inside a string
"
,
"
/(sub)?string/i
"
];
expect
(
await
transformation
.
transform
(
input
)).
toEqual
([
"
/(sub)?string/i
"
]);
});
});
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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