

Task

   match a string against a regular expression
   substitute part of a string using a regular expression


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)
}