[erlang-questions] Stripping slashes from a string

Sergei Golovan sgolovan@REDACTED
Fri Apr 27 09:17:18 CEST 2012


Hi, Martin!

On Fri, Apr 27, 2012 at 11:04 AM, Martin Dimitrov
<mrtndimitrov@REDACTED> wrote:
> Hi,
>
> I am not sure what it works for you. See what I get:
>
> (dilbert@REDACTED)16> re:replace("\\r \\n text", "\\\\(r|n)", "\\\\1",
> [{return,list}, global, unicode]).
> "\\1 \\1 text"
> (dilbert@REDACTED)17>

"\\\\1"  denotes the "\\1" string, so it means 'replace the matched pattern by
a single backslash and the number 1'. Try "\\\\\\1" (six backslashes) instead.

Cheers!
-- 
Sergei Golovan



More information about the erlang-questions mailing list