[erlang-questions] Re: Adoption of perl/javascript-style regexp syntax

Richard O'Keefe ok@REDACTED
Wed Jun 3 00:03:28 CEST 2009


On 2 Jun 2009, at 7:59 pm, mats cronqvist wrote:

> Geoffrey Biggs <geoffrey.biggs@REDACTED> writes:
>
>> Python provides a method of specifying strings they call "raw
>> strings," which I find quite interesting. Basically, you prefix your
>> string with r or R, and any backslashes are treated as literal
>> characters rather than escape sequences. For example:
>>
>>>>> '\b'
>> '\x08'
>>>>> r'\b'
>> '\\b'
>>
>> More info in the docs:
>> http://docs.python.org/3.0/reference/lexical_analysis.html#string-and-bytes-literals
>>
>> I'm not sure how well it would work in Erlang, but it's certainly
>> useful in Python for avoiding the headache-inducing backslash
>> acrobatics necessary when writing the occasional complex regular
>> expression.
>
>  +1

-1

This is simply the wrong way to deal with complex regular expressions.
Introducing elaborate mechanisms to hide from the compiler what's
going on, in order to parse things at run time that could have been
done earlier?

What's needed is a DOMAIN-SPECIFIC EMBEDDED LANGUAGE for regular
expressions, and all we need for that is lists, strings, constants,
and function calls.  By golly, we've GOT them!



More information about the erlang-questions mailing list