Skip to content

Commit 0aeea1b

Browse files
committed
require both flags
1 parent 04b49c9 commit 0aeea1b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/fable-library-ts/RegExp.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ export function create(pattern: string, options = 0) {
1818
flags += options & 1 ? "i" : ""; // 0x0001 RegexOptions.IgnoreCase
1919
flags += options & 2 ? "m" : "";
2020
flags += options & 16 ? "s" : "";
21-
flags += options & 1024 ? "l" : "";
21+
if (options & 1024) {
22+
if (options & 256) {
23+
flags += "l";
24+
}
25+
else {
26+
throw new Error("RegexOptions.NonBacktracking is only allowed together with ECMAScript");
27+
}
28+
}
2229
return new RegExp(pattern, flags);
2330
}
2431
// From http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex

0 commit comments

Comments
 (0)