RosettaCodeData/Task/Regular-expressions/Objeck/regular-expressions.objeck
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

17 lines
405 B
Text

use RegEx;
bundle Default {
class RegExTest {
function : Main(args : String[]) ~ Nil {
string := "I am a string";
# exact match
regex := RegEx->New(".*string");
if(regex->MatchExact(".*string")) {
"ends with 'string'"->PrintLine();
};
# replace all
regex := RegEx->New(" a ");
regex->ReplaceAll(string, " another ")->PrintLine();
}
}
}