Friday, September 9, 2011

Using the Erlang re module (Regular Expressions)

1> re:replace("/var/lib/test/nick", "^.*\/", "hi ",[{return,list}]).
"hi nick"

If  you don't specify the [{return,list}], you get something generally useless:
2>re:replace("/var/lib/test/nick", "^.*\/", "hi ").               
[<<"hi ">>|<<"nick">>]



References:
[1] http://www.erlang.org/doc/man/re.html

No comments:

Post a Comment