[erlang-questions] RegExp Behaviour

Dale Harvey harveyd@REDACTED
Sat Apr 18 12:37:33 CEST 2009


regexp:gsub("ab:de", ":", "\\&").

& replaces the match with the substring of the match, so it was just
replacing
c with c

regexp is deprecated though, and will probably be taken out the release
after
the one next week.

2009/4/18 Gordon Guthrie <gordon@REDACTED>

> Folks
> This looks like a bug to me, but after many years regexp still gives me the
> creeps :(
>
> > regexp:gsub("abcde", "c", "x").
> {ok, "abxde", 1}
>
> One substitution, new string, tickety-boo!
>
> > regexp:gsub("ab:de", ":", "&").
> {ok, "ab:de", 1}
>
> One substitution, but the old string, erk?
>
> Gordon
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090418/3451687e/attachment.htm>


More information about the erlang-questions mailing list