Libraries anvil lang pattern

class pattern
extends anvil.lang.object
Pattern represents compiled regular expression.

Constructor
pattern(string pattern)
pattern(string pattern, string flags)
Creates regular expression.
Parameters pattern -  Pattern string
flags -  String containing zero or more of Multiline, Ignore case, eXtended
Throws MalformedPattern -  If pattern is invalid


Methods

object contains(string text)
object contains(string text, list matches)
object contains(string text, array matches)
Checks is given string (partially) matches this pattern

iterator find(string text)
Finds all occurences from given string matching this pattern.

object matches(string text)
object matches(string text, list matches)
object matches(string text, array matches)
Checks is given string matches this pattern

list split(string text)
Splits given text to pieces according to this pattern.

string substitute(string text, string substition)
string substitute(string text, function substituter)
string substitute(string text, string substition, int amount)
string substitute(string text, function substituter, int amount)
Substitutes regions from string matching this pattern with given substitution.
Parameters Amount -  of occurences to subsitutute, if omitted all occurences are replaced

string substituteFirst(string text, string substition)
string substituteFirst(string text, function substituter)
Substitutes first region from string matching this pattern.