[erlang-questions] dots in regexps

Bob Ippolito bob@REDACTED
Tue Mar 30 16:11:23 CEST 2010


On Tue, Mar 30, 2010 at 6:45 AM, Fredrik Thulin <ft@REDACTED> wrote:
> On Tue, 2010-03-30 at 08:16 -0500, David Mercer wrote:
> ...
>> Parts of the string that do not match the regexp are unaffected by
>> re:replace, so are retained in the result.
>
> Thanks for explaining, it makes sense now.
>
> Silly me, since I know fully well that a new list is created, it seemed
> much more logical to me at the time that the \1 would only extract the
> three chars following "foo" and result in "foobar".

The \1 does only match the three chars following "foo", but the
replace operation leaves all unmatched portions of the string as-is in
the result.

-bob


More information about the erlang-questions mailing list