diff --git a/README.md b/README.md index 1c39ec3..2b30baa 100644 --- a/README.md +++ b/README.md @@ -59,16 +59,16 @@ Sets the JavaScript language version for generated patterns and flags. Later tar *Default: `'ES2024'`.* -## Unicode, mixed case sensitivity +## Unicode, mixed case-sensitivity -Oniguruma-To-ES fully supports mixed case sensitivity (and handles the Unicode edge cases) regardless of JavaScript [target](#target). It also restricts Unicode properties to those supported by Oniguruma and the target JavaScript version. +Oniguruma-To-ES fully supports mixed case-sensitivity (and handles the Unicode edge cases) regardless of JavaScript [target](#target). It also restricts Unicode properties to those supported by Oniguruma and the target JavaScript version. Oniguruma-To-ES focuses on being lightweight to make it better for use in browsers. This is partly achieved by not including heavyweight Unicode character data, which imposes a couple of minor/rare restrictions: - Character class intersection and nested negated classes are unsupported with target `ES2018`. Use target `ES2024` or later if you need support for these Oniguruma features. - A handful of Unicode properties that target a specific character case (ex: `\p{Lower}`) can't be used case-insensitively in patterns that contain other characters with a specific case that are used case-sensitively. - In other words, almost every usage is fine, inluding `A\p{Lower}`, `(?i:A\p{Lower})`, `(?i:A)\p{Lower}`, `(?i:A(?-i:\p{Lower}))`, and `\w(?i:\p{Lower})`, but not `A(?i:\p{Lower})`. - - Using these properties case-insensitively is basically never done intentionally, so you're unlikely to encounter this error unless it's actually catching a mistake. + - Using these properties case-insensitively is basically never done intentionally, so you're unlikely to encounter this error unless it's catching a mistake. ## Similar projects diff --git a/demo/index.html b/demo/index.html index fa66ad8..1e292c5 100644 --- a/demo/index.html +++ b/demo/index.html @@ -59,12 +59,43 @@

Try it


-    

The output shows the result of calling toRegExp. Oniguruma-To-ES includes functions to generate additional formats: compile (returns an object with pattern and flags strings), toOnigurumaAst, and toRegexAst (for an AST based on regex). You can run all of these from the console on this page. compile and toRegExp accept pattern and flags strings and an options object. toOnigurumaAst and toRegexAst accept a pattern and flags.

+

The output shows the result of calling toRegExp. Oniguruma-To-ES includes functions to generate additional formats: compile (returns an object with pattern and flags strings), toOnigurumaAst, and toRegexAst (for an AST based on regex). You can run all of these from the console on this page. compile and toRegExp accept pattern and flags strings and an options object. toOnigurumaAst and toRegexAst accept a pattern and flags. You can also pass ASTs to printAst.

diff --git a/src/generate.js b/src/generate.js index 1246ef4..d4ba7d8 100644 --- a/src/generate.js +++ b/src/generate.js @@ -124,8 +124,8 @@ function generate(ast, options) { } const result = gen(ast); - // By default, `regex` implicitly chooses flag u or v; control it instead if (!minTargetEs2024) { + // Switch from flag v to u. By default, `regex` implicitly chooses; control it instead delete result.options.force.v; result.options.disable.v = true; result.options.unicodeSetsPlugin = null;