regexp-tree icon indicating copy to clipboard operation
regexp-tree copied to clipboard

Regular expressions processor in JavaScript

Results 47 regexp-tree issues
Sort by recently updated
recently updated
newest added

Example: `/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9])\.)(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){2}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/i` is optimized to `/^(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|[1-9])\.(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){2}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/i` The first is considered a safe regex by safe-regex, the second one not.

I'm using `eslint-plugin-optimize-regex` and I would prefer `[-\w]` to *not* be transformed into `[\w-]`. This seems to be caused by `charClassClassrangesMerge`, which obviously I could just blacklist. But it would...

After optimization: `/\$\{[^}]+\}/u` -> `/\${[^}]+}/u`, I have `Invalid regular expression` error: ```sh const regex1 = /\$\{[^}]+\}/u const regex2 = /\${[^}]+}/u; VM356:1 Uncaught SyntaxError: Invalid regular expression: /\${[^}]+}/: Incomplete quantifier at...

``` /👍/u ``` parses differently to ``` /\u{1f44d}/u ``` The first is becoming 2 chars `\ud83d` and `\udc4d`. I might try and detect any unicode in the input string and...

E.g ``` /a{9007199254740993}/ ``` gives ```json { "type": "Quantifier", "kind": "Range", "from": 9007199254740992, "to": 9007199254740992, "greedy": true } ``` Note `9007199254740992` not `9007199254740993`. I wonder if the parser should throw...

When I parse the regex `/[\w-z]/` it should throw an error, but instead parses as a regular character range with \w at the beginning. [https://astexplorer.net/#/gist/124dd2c7d464e3cf68b532bf8dacae7f/01a86f60e792112367c9395cf1094b5806dcaab1](https://astexplorer.net/#/gist/124dd2c7d464e3cf68b532bf8dacae7f/01a86f60e792112367c9395cf1094b5806dcaab1) If I figure out how...

Hi, ```js regexpTree.parse('/{/u'); ``` This should I think throw a `SyntaxError` as it does when running the code. Thanks!

Thank you for a library with such hight quality :). I just integrated `regexp-tree` into [Putout linter](https://github.com/coderaiser/putout/tree/master/packages/plugin-regexp), [run it on my code](https://github.com/coderaiser/putout/commit/23151e22b668f5260e800a301b37340e7d12611a), and had seen a strange optimization: ```js require('regexp-tree').optimize(/[=!]/).toString()...

This regexp is optimized like this: ```diff - /lorem(?:.|\n)*?ipsum/m + /lorem[.\n]*?ipsum/m ``` This breaks the regex: * `(.|\n)` means "any character, including a newline character" * `[.\n]` means "a period...