SYNTAX

<String>.regexReplaceString(regularExpression,replacementString)

DESCRIPTION

Returns a new String where the strings matching the regular expression are replaced by the replacement string.
Note: Regular expressions are a well-established technique that uses a sequence of characters to define a search pattern. For more information, see Wikipedia, as well one of the many sites that provide examples, such as regular-expresssions.info, and others that analyze the expressions you create.

USAGE RESTRICTIONS

The Operators row of the table in Summary Table of Vocabulary Usage Restriction applies. No special exceptions.

RULESHEET EXAMPLE

This sample Rulesheet uses regexReplaceString in non-conditional actions as follows:
  • regexReplaceString("[0-9]", "X"): Replace all instances of digits with the character X
  • regexReplaceString(" {2,}", " ") - Replace all instances of multiple spaces with a single space
  • regexReplaceString("[aeiou]", ".") - Replace all vowels with a dot .
  • regexReplaceString("[^aeiou]", ".") - Replace all non-vowel characters with a dot.
  • regexReplaceString("[c-v]", ".") - Replace each character in the range from c to v with a dot.
  • regexReplaceString('^[ \t]+|[ \t]+
    #39;, '')
    - Strip off leading and trailing spaces.


SAMPLE RULETEST

A sample Ruletest shows the regexReplaceString effect in output.