| Cellicium -> Erlang -> Contributions | | Home | Jobs | |
gregexp: Regular expressions with submatches
This module extends 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:
Eshell V5.0.1.1 (abort with ^G)
1> RE_URL="\\(.+\\)://\\(.+\\)\\(/.+\\)(\\?\\(.*\\)(&\\(.*\\))*)?".
"\\(.+\\)://\\(.+\\)\\(/.+\\)(\\?\\(.*\\)(&\\(.*\\))*)?"
2> gregexp:groups("http://localhost:81/script?arg", RE_URL).
{match,["http","localhost:81","/script","arg"]}
3> gregexp:groups("http://localhost:81/script?arg&arg2&arg3", RE_URL).
{match,["http","localhost:81","/script","arg","arg2","arg3"]}
Download the module and test suite:
gregexp-1.9.2.tar.gz
or a patch for regexp.erl:
gregexp-1.9.2.patch.
pool_server: A generic load-balancer for Erlang gen_servers.
Download the module and test suite (pre-release): pool_server-0.1.tar.gz.