regexr
regexr copied to clipboard
Unicode char code \u{code} not recognized when it contains letter
Hello there. First of all thanks a lot for RegExr, it's such a great and easy-to-use tool, it's almost a daily companion for me 👍
Description
I noticed a little bug: using unicode flag, unicode escaped characters that contains letters in their code don't print properly in the explanation box (both in the "Explain" tab in the tools box at the bottom, and in the expression input box on top).
Example
Looking for character \u{0020}
(/\u{0020}/u
), it matches perfectly space character, no problem.
Looking for character \u{002A}
(/\u{002A}/u
)
- it matches asterisk (*) characters in the text box, "Replace", "List", "Details" tools tab (no prob) BUT
- it displays the following error message in the "Explain" tab and the Expression box:
\u ERROR: Invalid escape sequence.
(And I know that brackets are not needed for four-char long unicode codes and \u002A
works fine, but I use them for five-char long ones and the bug is the same.)
Thanks again for your time 🙂
I wrote a library a while back that might be helpful for resolving this depending on how the escape sequences are being handled - https://github.com/iansan5653/unraw.