You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If it wasn’t for the bug described in #192 (where interpolation isn’t currently allowed inside character classes), you could replace the second line with const re = XRegExp.tag()`[${chars}]+`;.
Note that for usage with plain JS regular expressions (i.e. without XRegExp), regenerate solves this problem. Given a set of characters, it produces a valid & ASCII-safe JS regular expression pattern that matches only those characters.
Feature request (for discussion):
It would be useful to be able to create a new character set from a string array of allowed chars.
At this time I have my own static function that escapes and joins chars from string array, however, I think it can be useful also for others.
Example implementation:
The text was updated successfully, but these errors were encountered: