17 lines
405 B
Text
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();
|
|
}
|
|
}
|
|
}
|