Regular Expressions

matches()

matches('abcd','a'): true
matches('abcd','^ab'): true
matches('abcd','ab$'): false
matches('abcd','cd$'): true
matches('abcd','[a-z]{4}'): true
matches('abcd','[A-Z]{4}'): false

tokenize()

tokenize('a,b,c,d',','):

tokenize('2006-12-25T12:15:00','[\-T:]'):

tokenize('a,,,b,c', ','):

tokenize('a,,,b,c', ',+'):

replace()

replace('ababab', 'b', 'xx'): axxaxxaxx
replace('ababab', 'zz', 'xx'): ababab
replace('ababab', 'ab', 'xx'): xxxxxx
replace('ababab', '(ab)+', 'xx'): xx
replace('2315551212', '(\d{3})(\d{3})(\d{4})', '($1) $2-$3'): (231) 555-1212