opal
opal copied to clipboard
ruby start and end of string regex tokens not transpiled
\A
to mean start of a string, and \Z
to mean end of a string are taken as literal escaped capital A and escaped capital Z, rather than being transpiled into their true meanings
I think the best approach here would be to warn about possible errors and compile those two (and related) to ^$
, at lead while we're still using native js regexps
@patrickkettner @elia master already has this logic - https://github.com/opal/opal/blob/master/lib/opal/nodes/literal.rb#L170
@iliabylich - thanks! any idea why this isn't in 0.10.3? This is also only doing \z
and not \Z
(which is funny, because I believe $
actually maps to \Z
better than \z
).
I've also since found that opal is broken on \G
why this isn't in 0.10.3?
That's because we backport to the current stable just the minimum, otherwise it would become much less… stable.
That said,\Z
should problably map to $
too. And \G
should print a warning.
\Z is something like /(?>\r?\n?$)/