The regular expression WAIF allows you to easily use regular expressions on the MOO without having to mess around with extremely confusing arrays, which usually require three subscripts to access data.

The regular expression WAIF defines the following functions:

  • new - This function returns a new $regexp WAIF. It takes one optional parameter, which is the regular expression itself (regular-expressions). The parameter can be excluded and later specified by altering the 'regex' property of the WAIF.
  • reset - This function resets the properties _1 to _9, lastMatch, leftContext, and rightContext to 0.
  • exec - This function executes the regular expression. It requires one argument, the string to execute against. This function populates properties to show the results of the match.
  • The regular expression WAIF defines the following properties:

  • _1 ... _9 - After the 'exec' of a regular expression WAIF, these variables contain sub strings extracted from the given string by the regular expression.
  • lastMatch - After the 'exec' of a regular expression WAIF, this contains the text that was matched by the regular expression.
  • leftContext / rightContext - After the 'exec' of a regular expression WAIF, these properties contain the rest of the matched string to the left or right of the text in the lastMatch property.
  • regex - Contains the text of the regular expression.
  • global - A boolean value, currently not used.
  • ignore_case - A boolean value, currently not used.
  • Regular expression matching builtin function. Regular expression help.
    .