Closed stalniy closed 4 years ago
Hi @stalniy ,
thanks for reporting this issue!
Parsing the provided regexp works fine when using the online version: http://www.julianviereck.de/regjsparser/#%2F%5B%5C%5D%7D%7B%5D%2B%2F.
What you need to do is to escape the backslash in the string once more. That is
old: parse('[\]}{]+')
new: parse('[\\]}{]+')
Then the parsing works for me.
Can you please check and if this fixes your problem close the issue?
Let me know in case you have any questions.
Thanks for the quick response. Give few minutes I’ll retest!
OK, so looks like this is not an issue on your side. Some code passes unescaped regexp in parse
function and I get this error:
SyntaxError: /home/sergii/projects/casl/docs-src/bootstrap.6af6ddda.js: unescaped or unmatched closing brace at position 25
;?@[-\]_{}\u00A0\u00
^
bootstrap.6af6ddda.js
SyntaxError: /home/sergii/projects/casl/docs-src/bootstrap.6af6ddda.js: unescaped or unmatched closing brace at position 25
;?@[-\]_{}\u00A0\u00
^
at bail (/home/sergii/projects/casl/docs-src/node_modules/regjsparser/parser.js:1131:13)
at createCharacter (/home/sergii/projects/casl/docs-src/node_modules/regjsparser/parser.js:239:11)
at parseClassAtomNoDash (/home/sergii/projects/casl/docs-src/node_modules/regjsparser/parser.js:1107:16)
at parseClassAtom (/home/sergii/projects/casl/docs-src/node_modules/regjsparser/parser.js:1096:16)
at parseNonemptyClassRangesNoDash (/home/sergii/projects/casl/docs-src/node_modules/regjsparser/parser.js:1075:17)
at parseHelperClassRanges (/home/sergii/projects/casl/docs-src/node_modules/regjsparser/parser.js:1040:13)
at parseNonemptyClassRangesNoDash (/home/sergii/projects/casl/docs-src/node_modules/regjsparser/parser.js:1086:14)
at parseHelperClassRanges (/home/sergii/projects/casl/docs-src/node_modules/regjsparser/parser.js:1040:13)
at parseNonemptyClassRanges (/home/sergii/projects/casl/docs-src/node_modules/regjsparser/parser.js:1066:14)
at parseClassRanges (/home/sergii/projects/casl/docs-src/node_modules/regjsparser/parser.js:1010:15)
Sorry for disturbing
Hi
Thanks for your package! It appears that babel plugin use it to convert regexps.
I found an issue with it. This is a valid js regexp
[\]}{]+
but when you try to parse it usingregjsparser
you will get an error.The workaround is to escape
{
and}
but this regexp is not my package, that's why I decided that it needs to be fixed here instead