jakarta-regexp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Walid Joseph Gedeon" <wged...@nerim.net>
Subject Re: Project enhancement proposal
Date Thu, 04 Dec 2003 14:13:05 GMT
Hello Vadim,
    Thanks for replying.

> Simple regexp:
>     ^key is = ([:alphanum:]*), value is = ([:alphanum:]*)$
>
> Will return you two parens, first one is value for param1, and second
> one is value for value1. Put values in the map, and you are done. You
> can also define generic paren list -> values map mapping (and store it
> in separate string, not in regexp itself), and use this mapping to
> populate result map from paren list:
>     String[] map =  { null, "param1", "value1" };
>     for (...) results.put(map[i], re.getParen(i));

Doubt had lingered after reading this (I worried for optional parts), but
quickly went away after having a success with:

    ^key is = ([:alnum:]*)( auto)?, value is = ([:alnum:]*)$
giving
    ("key", null, "val")    for "key is = key, value is = val"
and ("key", " auto", "val") for "key is = key auto, value is = val"

I guess my enhancement was indeed useless, oh well, maybe next time :)

Thanks :)


---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org


Mime
View raw message