[erlang-questions] beginner: How should regexp:split/2 be replaced?

Bengt Kleberg bengt.kleberg@REDACTED
Tue Apr 19 15:30:25 CEST 2011


Greetings,

I have inherited some code without a test directory. I get the following
compiler warnings:
./compile_funcs.erl:603: Warning: regexp:split/2: the regexp module is
deprecated (will be removed in R15A); use the re module instead
./compile_funcs.erl:645: Warning: regexp:matches/2: the regexp module is
deprecated (will be removed in R15A); use the re module instead

The lines are:
            {ok, Class} = regexp:split(Class0, "[ ]*,[ ]*"),
and
    {match,A}=regexp:matches(String,"\n"),

I thought "[ ]*,[ ]*" would mean:
the character class of " " (space), 0 or many times, followed by literal
"," followed by the character class of " " (space), 0 or many times.

This is not the case and I am not having any luck with randomly
constructing strings to find one that triggers a Class that is different
from Class0.

Perhaps someone knows what "[ ]*,[ ]*" really means, and what to replace
these with when using the re module.


bengt




More information about the erlang-questions mailing list