[erlang-questions] re:replace and bad argument

Mariano Guerra luismarianoguerra@REDACTED
Sat Jun 19 16:06:39 CEST 2010


On Sat, Jun 19, 2010 at 10:49 AM, info <info@REDACTED> wrote:
> I want to replace the "),(" string by the "/" char.
>
> re:replace("(a,b),(c,d)","),(","/",[{return,list}]).
>
> I received this message:
>
> ** exception error: bad argument
>     in function  re:replace/4
>        called as re:replace("(a,b),(c,d)","),(","/",[{return,list}])
>

your regular expression is invalid, you need to quote the parenthesis

this should work:

5> re:replace("(a,b),(c,d)","\\),\\(","/",[{return,list}]).
"(a,b/c,d)"


More information about the erlang-questions mailing list