Mon Nov 19 20:05:18 CET 2001
I think the documentation could be made much clearer.
My experience is that regexp:match selects the longest
match when the match can start at *different* positions
in the string. Keep in mind, a match at any given
position is *always* the longest match.
In Niels' case,
There are two matches in the string:
But because of greediness there is no match
for the first 6 characters; they're consumed
in the first match case.
To see the difference with match and first_match,
try adding an optional pattern to differentiate
the longest from the first match.
1> regexp:match("12123", "123?").
2> regexp:first_match("12123", "123?").
From: Bengt Kleberg [mailto:eleberg@REDACTED]
Subject: Re: regexp:first_match
According to the documentation
will get thet longest match, exactly as you state.
is documented as only matching the first match (which should be the one
More information about the erlang-questions