[erlang-questions] RegExp Behaviour

Gordon Guthrie gordon@REDACTED
Sat Apr 18 12:42:09 CEST 2009


B
How embarrassing, I read the documentation for gsub, and read and re-read
the regexp character stuff elsewhere in the documentation, but didn't read
what was staring me in the face...

However, on reading it, the phrase:

"A & in the string New is replaced by the matched
substring of String."

leaves me completely bemused. 'on doing a substitution, don't'.

I suppose it could have some 'flow of control use'?

G

On Sat, Apr 18, 2009 at 11:28 AM, Bernard Duggan <bernie@REDACTED> wrote:

> 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
> > 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/707e309d/attachment.htm>


More information about the erlang-questions mailing list