[erlang-questions] RegExp Behaviour

Bernard Duggan <>
Sat Apr 18 12:28:00 CEST 2009


I'd say it's behaving just fine.  Check the documentation for
regexp:sub().  "A & in the string New is replaced by the matched
substring of String."

Cheers,

B

Gordon Guthrie wrote:
> 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
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list