String processing - regex

Corrado Santoro csanto@REDACTED
Fri Jun 10 14:22:46 CEST 2005


What about writing a grammar and use yecc?

--Corrado

Casper wrote:
> 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
> 
> 
> 
> 


-- 
======================================================
Eng. Corrado Santoro, Ph.D.

University of Catania - Engineering Faculty
Department of Computer Science and
Telecommunications Engineering
Viale A. Doria, 6 - 95125 CATANIA (ITALY)

Tel: +39 095 7382144 Int. (5) 8035
      +39 095 7382380
      +39 095 7382365
      +39 095 7382364

VoIP: sip:8035@REDACTED

Fax: +39 095 7382397

EMail: csanto@REDACTED
Personal Home Page:
             http://www.diit.unict.it/users/csanto

NUXI Home Page:
             http://nuxi.iit.unict.it
======================================================




More information about the erlang-questions mailing list