RosettaCodeData/Task/Regular-expressions/Objeck/regular-expressions.objeck
2023-07-01 13:44:08 -04: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();
}
}
}