Regex literal expressions


#1

I’d like to request a regex literal feature.

Example:
val pattern2:Regex = /test-\d/i;

The main reason I feel it’s important is that without it, escaping gets unreadable quickly.


#2

Are you aware of raw strings?

val r = Regex("""\d+""")

I never liked special strings for regex like in Perl.


#3

Ah, thanks. For some reason I was thinking raw strings still used \ as an escape character. So the only thing you’d need to escape is the $. I think that’ll be fine.
I liked regex literals in AS3, I miss it :).


#4

Note that escaping the $ in raw strings is done using

"""${'$'}"""