regexp module with submatches available

Pascal Brisset pascal.brisset@REDACTED
Mon Mar 26 13:40:51 CEST 2001


We have extended the regexp module in OTP R7B-1 with support for
submatches (the '\(...\)' syntax in SED regular expressions).
This makes it possible to retrieve several components of a match with
a single evaluation of a regexp. For example:

1> RE_URL="\\(.+\\)://\\(.+\\)\\(/.+\\)(\\?\\(.*\\)(&\\(.*\\))*)?",
1> gregexp:groups("http://localhost:81/script?arg&arg2&arg3", RE_URL).
{match,["http","localhost:81","/script","arg","arg2","arg3"]}

gregexp is available from http://www.cellicium.com/erlang/contribs/

-- Pascal Brisset <pascal.brisset@REDACTED> +33141986741 --
--- Cellicium R&D | 73 avenue Carnot | 94230 Cachan | France ---




More information about the erlang-questions mailing list