[erlang-questions] Stripping slashes from a string
Martin Dimitrov
mrtndimitrov@REDACTED
Fri Apr 27 09:19:57 CEST 2012
With 6 it produces double backslashes making the result equivalent to
the initial text:
(dilbert@REDACTED)17> re:replace("\\r \\n text", "\\\\(r|n)",
"\\\\\\1", [{return,list}, global, unicode]).
"\\r \\n text"
(dilbert@REDACTED)18>
Best regards,
Martin
On 4/27/2012 10:17 AM, Sergei Golovan wrote:
> 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!
More information about the erlang-questions
mailing list