String processing - regex

Casper <>
Fri Jun 10 13:08:49 CEST 2005


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?

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

But
	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