mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 12:51:57 +00:00
- Fix example to handle `new RegExp()` too
- Update NOTE comments
- - -
Until I tried interacting with the actual AST parsed by `oxc_parser`, I thought that the current `oxc_regular_expression` lacked support for the `RegExp` constructor due to escape sequences.
This was because `"\""` remained `"\""` after reading the source text from `.js` files.
However, once it was parsed by `oxc_parser`, I found that everything was [resolved](8ef85a43c0/crates/oxc_parser/src/lexer/string.rs)! (Wonderful work as usual. 👏🏻 )
Now there is nothing to worry about. 😌
7 lines
178 B
JavaScript
7 lines
178 B
JavaScript
// All of them should be the same result!
|
|
[
|
|
/\1(.)\\"'`a/v,
|
|
new RegExp("\\1(.)\\\\\"'`\a","v"),
|
|
new RegExp('\\1(.)\\\\"\'`\a','v'),
|
|
new RegExp(`\\1(.)\\\\"'\`\a`,`v`),
|
|
]
|