[erlang-questions] regexp sux! (but perhaps less now)

Bengt Kleberg <>
Tue Jun 5 08:45:56 CEST 2007


On 2007-06-04 22:34, Robert Virding wrote:
> tobbe wrote:
>> 1> re:match("now/plus42hours/","^now/(plus|minus)(\d{1,2})hours/$").
>> nomatch
>> 2> re:smatch("now/plus42hours/","^now/(plus|minus)([[:alnum:]])hours/$").
>> nomatch
>> 3> re:smatch("now/plus42hours/","now/(plus|minus)([[:alnum:]])hours/").
>> nomatch
> 
> OK:
> 1) \d is a PERLism and as I wrote I only support POSIX style regexps. As 
> the regexp is a string it would have to be "\\d" as the '\' needs to be 

if somebody is interested in something else than ''normal regular 
expressions'' (where normal is awk, sed, posix, perl, etc) i can recommend
http://www.scsh.net/docu/html/man-Z-H-7.html#node_idx_1178

it is regexp for the scheme shell. it has s-expressions instead of 
strings. i find it easier to use when the regular expression goes beyond 
that which is possible to do with strstr and friends.


bengt
-- 
Those were the days...
    EPO guidelines 1978: "If the contribution to the known art resides
    solely in a computer program then the subject matter is not
    patentable in whatever manner it may be presented in the claims."



More information about the erlang-questions mailing list