Commit cca6f19a authored by Diegodlh's avatar Diegodlh
Browse files

wrap regular expressions between "/" and use double quoutes to force plain string matching

parent 47e88b01
......@@ -277,13 +277,20 @@ describe("Match transformation", () => {
expect(await transformation.transform(input)).toEqual(["sub,string"]);
});
it("uses regular expressions", async () => {
it("supports regular expressions between //, including flags", async () => {
const transformation = new MatchTransformation(false);
transformation.config = "(sub)?string";
const input = ["a substring inside a string"];
transformation.config = "/(sub)?string/i";
const input = ["a Substring inside a string"];
expect(await transformation.transform(input)).toEqual([
"substring",
"Substring",
"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"]);
});
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment