[erlang-questions] & is not getting replaced in re:replace

Fred Hebert mononcqc@REDACTED
Mon May 3 19:26:52 CEST 2010


That's a standard regex character. The & usually hints at something like a
reference to a capture in the regular expression. You need to escape it:

1> re:replace("hell<o children", "<", "\\&", [{return, list}, global]).
"hell&o children"

On Mon, May 3, 2010 at 1:16 PM, Wes James <comptekki@REDACTED> wrote:

> Is there something special with "&" in erlang.
>
>
> re:replace(T, "<", "&", [{return, list}, global]).
> "<"
>
> I noticed that a string I had was not getting changed and it came down
> to the above re:replace of "<" with "&" return "<".  Why?
>
> thx,
>
> -wes
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list