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
Named backrefs in conditional expressions ((?(<name>)yes|no)) behave differently from normal named backrefs (\k<name>) in Ruby syntax. \k<name> checks the last group with the name, if not matched then the previous one, and so on, until there is a match. (
When backreferencing with a name that is assigned to more than one groups,
the last group with the name is checked first, if not matched then the
previous one with the name, and so on, until there is a match.
)
However (?(<name>)yes|no) only checks the left most group with the name. This behavior of the conditional expressions is the same as Perl, but inconsistent for Ruby.
The same strategy with \k<name> should be used for Ruby syntax.
Named backrefs in conditional expressions (
(?(<name>)yes|no)
) behave differently from normal named backrefs (\k<name>
) in Ruby syntax.\k<name>
checks the last group with the name, if not matched then the previous one, and so on, until there is a match. (Onigmo/doc/RE
Lines 321 to 323 in b334081
However
(?(<name>)yes|no)
only checks the left most group with the name. This behavior of the conditional expressions is the same as Perl, but inconsistent for Ruby.The same strategy with
\k<name>
should be used for Ruby syntax.Related: #74
The text was updated successfully, but these errors were encountered: