String processing - regex

casper2000a <>
Sat Jun 11 03:52:17 CEST 2005


Hi Laurent,

Thanks for the info. But I tried that too,
gregexp:groups("<mod:fun(arg1, arg2, arg3, arg5,arg6)>", "<\\(.+\\):\\(.+\\)[(]\\(.+\\)(,[\s]*\\(.+\\))*[)]>").
   --> {match,["mod","fun","arg1"," arg2"," arg3"," arg5","arg6"]}

The result I get then have a space infront of arg2, arg3 and arg5. I want to get rid of any spaces in 
front. Ofcourse I can trim manually, but I'm sure there must be a way to get that done in one parse 
using regexp.

Regards,
- Eranga


Quoting Laurent Picouleau : > Quoting Laurent Picouleau :

> Hi Eranga,
> 
> On Fri, 2005-06-10 at 13:24, Casper wrote:
> > Also I tried with Cellicium\'s gregexp module.
> > 
> > \"\"
> > 
> > I did it like,
> > gregexp:groups(\"\",
> > \"<\\\\(.+\\\\):\\\\(.+\\\\)[(]\\\\(.+\\\\)(,[\\s*]\\\\(.+\\\\))*[)]>\").
> > --> {match,[\"mod\",\"fun\",\"arg1\",\"arg2\",\"arg3\",\"arg5,arg6\"]}
> > 
> > Only problem is last one doesn\'t get parse well..
> 
> modify your regex to put [\\s]* instead of [\\s*] and you should have arg5
> and arg6.
> 
> Br,
> 
> -- 
> Laurent Picouleau
> 
> 
> 

--------------This mail sent through OmniBIS.com--------------




More information about the erlang-questions mailing list