regexp:first_match

Happi happi@REDACTED
Mon Nov 19 21:55:36 CET 2001


----- Original Message ----- 
From: "Niels Christensen" <christen@REDACTED>
[...]
> However, first_match is not even consistently greedy.
> When using the expression "<.+>" in a long SGML file,
> it sometimes matches just one tag, sometimes matches across several,
> but not the whole file (as it could have).
> I cannot find a simple example to illustrate the behaviour,
> but it seems to prefer ending its match at newlines.

There seem to be a bug in the manual for regexp, it states
that: 
 .     matches any character.
but in fact "." matches any character but "\n".
(Which is the usual definition for "." in regular expression.)
>From the source:
 reg4([$.|S]) -> {{comp_class,"\n"},S};
"." is treated as the complement of  "\n"


/Erik





More information about the erlang-questions mailing list