[erlang-questions] regular expressions (again :)

Gaspar Chilingarov nm@REDACTED
Wed Dec 13 13:24:39 CET 2006

Christian S wrote:
>> > Calling regexp:match or similar functions is too ugly.
> Hide them behind a function. We have closures so returning
> a function is trivial.
> Re = compile("a(b*)a"),
> case Re("abba") of
>   match ->
>      erlang:display("yaaaay!");
>   nomatch ->
>      erlang:display("boooo!")
> end

In most text-processing tasks you do not need exactly same regexp second 
time. hm, well ;) I want to have regexps without names -- yes, this 
sounds exactly like funs. But I'm against funs -- we have lists:map and 
we have list comprehension -- second one is quite easier to read in case 
of small transformations.

Gaspar Chilingarov

System Administrator,
Network security consulting

t +37493 419763 (mob)
i 63174784

More information about the erlang-questions mailing list