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
Example: RegExp.make`[${/(?=a)b/i}]` returns /[ABab]/, even though the a is only part of an assertion and not part of what the regex is capable of matching.
You could make a similar case for RegExp.make`[${/a{0}b/}]`, which returns /[ab]/, but maybe shouldn't include the a since it can't be matched. Same goes for RegExp.make`[${/|b/}]` where the b can never be matched. These cases might be unreasonable, but I think that all of these examples help illustrate the strangeness / non-intuitiveness of the design decision to make RegExp instances interpolated in character classes work this way (even though it's a cool feature).
The text was updated successfully, but these errors were encountered:
Example:
RegExp.make`[${/(?=a)b/i}]`
returns/[ABab]/
, even though thea
is only part of an assertion and not part of what the regex is capable of matching.You could make a similar case for
RegExp.make`[${/a{0}b/}]`
, which returns/[ab]/
, but maybe shouldn't include thea
since it can't be matched. Same goes forRegExp.make`[${/|b/}]`
where theb
can never be matched. These cases might be unreasonable, but I think that all of these examples help illustrate the strangeness / non-intuitiveness of the design decision to makeRegExp
instances interpolated in character classes work this way (even though it's a cool feature).The text was updated successfully, but these errors were encountered: