|
|
|
NOTE: This Design document is subject to change at any time. |
Performs a regular expression match of the RegEx pattern in the Source string and then replaces the matched section with the ReplaceStr string. The match is performed beginning at the Start position in the Source string. If Start is omitted, the match is performed at the beginning of the Source string.
The ReplaceStr can contain the \1..\99 variables (also referenced with $1..$99 for compatibility) to insert substrings matched by patterns enclosed in () in the RegEx string.
The Options string can be used to set various regular expression options, including the 'e' option which will cause the resulting replacement string to be evaluated using the default scripting language before being returned. If Options is omitted, no additional options are applied.
For example:
str.RegReplace("(http://\w+(\.\w+)*/?)", "<a href=""\1"">\1</a>", Source, "a", 1)
would replace any URL in the source string with the HTML <A> tag turning it into a hyperlink. The "a" option causes ALL matches to be replaced instead of just replacing the first match found in the source string. |
|