i can't say i'm too fond of this, but i thought of bringing this up. most scripting<br>languages (perl, ruby, and boo, to name some) have regular expressions as<br>language literals. since such languages are heavily used for string
<br>manipulation, it might seem like a good idea to add them at the syntax level:<br><br>e"[A-Za-z_][A-Za-z_0-9]*"<br><br>i thought of prefixing "e" for "regular *e*xpression". could also be "p" for pattern.
<br>it's very simple -- regex literal strings are just passed to re.compile(), upon <br>creation, i.e.:<br>a = e"[A-Z]"<br><br>is the same as<br>a = re.compile("[A-Z]")<br><br>what is it good for?<br><br>
if e"[A-Z]".match("Q"):<br> print "success"<br><br>since strings (as well as regex strings) are immutable, the compiler can <br>re.compile them at compile time, as an optimization. <br><br>
again, i can't say i'like regex literals, and i don't think it would be a <br>productivity boost (although you would no longer need to import re and<br>re.compile() your patterns)... but i wanted to bring it to your consideration.
<br><br><br>-tomer