Error prone behavior of regexp. / Emacs mode.

Pierpaolo BERNARDI <>
Sun Mar 30 08:23:42 CEST 2003


Several functions in regexp behave like this:

22> regexp:match("foo",xxx).
nomatch

That is, if the r.e. is not a list, it is assumed to be an already
parsed r.e. with no safety check whatsoever.

I tripped in this doing by mistake:

RE = regexp:parse([$t,$r,$e,$$]),
lists:map(fun(P)-> ...
                   {ok,S3,_} = regexp:sub(P,RE,"tré"),

Surely my fault, but the module could easily be more helpful.

-----

On another topic, the emacs mode misparses strings ending in $.
In "foo$",  $" is parsed as a character, compromising
the indentation of the rest of the file.   Before I start digging in the
emacs mode, maybe someone has already fixed this?

P.




More information about the erlang-questions mailing list