Skip to content

Commit 615cd30

Browse files
committed
no 'g' either for browser compatibility
1 parent 994fcd4 commit 615cd30

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/fable-library-ts/RegExp.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ export function create(pattern: string, options = 0) {
1212
throw new Error("RegexOptions only supports: IgnoreCase, Multiline, Compiled, Singleline, ECMAScript and NonBacktracking");
1313
}
1414

15+
let flags = "";
1516
// Set global and unicode flags for compatibility with dotnet, see #2925
16-
let flags = "g";
17-
// add unicode only if not NonBacktracking, 'l' and 'u' together are not allowed
18-
flags += options & 1024 ? "l" : "u";
17+
// for NonBacktracking, add just 'l', ('u' + 'l' is unsupported, 'g' + 'l'
18+
// is supported only with '--enable-experimental-regexp-engine')
19+
flags += options & 1024 ? "l" : "gu";
1920
flags += options & 1 ? "i" : ""; // 0x0001 RegexOptions.IgnoreCase
2021
flags += options & 2 ? "m" : "";
2122
flags += options & 16 ? "s" : "";

0 commit comments

Comments
 (0)