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

Bengt Kleberg <>
Tue Jun 2 10:14:54 CEST 2009


Greetings,

If the only problem solved with "raw strings" is regular expressions I
would not recommend it. Instead I would suggest moving away from strings
for regular expressions. For an example see SCSH
(http://www.scsh.net/mail-archive/scsh-users/2003-01/msg00048.html).


bengt

 On Tue, 2009-06-02 at 09:59 +0200, mats cronqvist wrote:
> Geoffrey Biggs <> 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
> 
>   mats
> 
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
> 



More information about the erlang-questions mailing list