escaping chars in re:replace

Wes James <>
Tue Jul 27 22:40:58 CEST 2010


I'm replacing some values in some data.  It looks like when using

re:replace here:

http://www.erlang.org/doc/man/re.html

the RE parameter needs to have the chars *, [, (,) escaped to be used.

For example:

re:replace("this*", "*", "!", [{return,list}, global, caseless])

will error out with a bad argument error.  But this will work:

re:replace("this*", "\\*", "!", [{return,list}, global, caseless])


What other chars should I be looking for that need to be escaped?  The
RE value comes in as a variable, so I will need to change any of these
chars to escaped before using it in re:replace.

thx,

-wes


More information about the erlang-questions mailing list