Erlang (programming language)/Tutorials/regexp

From Citizendium
< Erlang (programming language)‎ | Tutorials
Revision as of 19:16, 19 April 2008 by imported>Eric Evers (New page: =Regular Expressions= Regular Expressions 2> regexp:match("hello world","w.+d"). {match,7,5} The regular expression, "w.+d" matches th...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Regular Expressions

Regular Expressions

2> regexp:match("hello world","w.+d").
{match,7,5}

The regular expression, "w.+d" matches the string, "hello world" at location 7 for 5 chars.

9> regexp:sub("10203040","([2|3|4]0)+","01").
{ok,"1001",1}

Makes a substitution, replacing "203040" with "01".