[erlang-questions] Why is it necessary to "double-escape" [ characters in regular expressions?

Sverker Eriksson sverker@REDACTED
Mon Mar 30 14:06:15 CEST 2009

David Mitchell wrote:
> However, I didn't expect that "double escaping" it would be the solution to
> my problem.
 From http://erlang.org/doc/man/re.html:


The Erlang literal syntax for strings give special meaning to the "\" 
(backslash) character. To literally write a regular expression or a
replacement string containing a backslash in your code or in the shell, 
two backslashes have to be written: "\\".

/Sverker, Erlang/OTP Ericsson

More information about the erlang-questions mailing list