14 lines
320 B
Plaintext
14 lines
320 B
Plaintext
alias regular_expressions {
|
|
var %string = This is a string
|
|
var %re = string$
|
|
if ($regex(%string,%re) > 0) {
|
|
echo -a Ends with string.
|
|
}
|
|
%re = \ba\b
|
|
if ($regsub(%string,%re,another,%string) > 0) {
|
|
echo -a Result 1: %string
|
|
}
|
|
%re = \b(another)\b
|
|
echo -a Result 2: $regsubex(%string,%re,yet \1)
|
|
}
|