String processing - regex

Casper casper2000a@REDACTED
Fri Jun 10 14:24:38 CEST 2005

Also I tried with Cellicium's gregexp module.

"<mod:fun(arg1, arg2, arg3, arg5,arg6)>"

I did it like,
gregexp:groups("<mod:fun(arg1, arg2, arg3, arg5,arg6)>",
	--> {match,["mod","fun","arg1","arg2","arg3","arg5,arg6"]}

Only problem is last one doesn't get parse well..

Thanks in advance!
- Eranga

-----Original Message-----
From: owner-erlang-questions@REDACTED
[mailto:owner-erlang-questions@REDACTED] On Behalf Of Casper
Sent: Friday, June 10, 2005 5:09 PM
To: erlang-questions@REDACTED
Subject: String processing - regex

Hi All,

What's the best way to parse a string, such as
	"blahhh another word <mod:fun(arg1, arg2)> word2 test"

As correctly extract,
	[mod, fun, arg1, arg2]

Can I use io_lib:fread/2 or regex:split/2? Could anyone kindly give me the
correct Format or RegExp string, since I am finding difficulty is getting
the correct one?

	io_lib:fread("~s:", "test:"). --> Error

	io_lib:fread("~s :", "test :"). --> {ok,["test"],[]}

Is it a must to have a space character to decode like above? Isn't there any
better way to decode it in the original way ("test:")?

Thanks in advance!
- Eranga

More information about the erlang-questions mailing list