ReplaceRegex
Sub ReplaceRegex($source As String, $searchRegex As String, $replaceStr As String) As String
Returns a string in which a specified substring, defined by a Regular Expression, is replaced with another substring. All matching occurrences are replaced.
ReplaceRegex is case-insensitive.
Parameters
- $source ... String expression that contains the substring to replace.
- $searchRegex ... Regular Expression to search for.
- $replaceStr ... Substring used as the replacement.
Example:
Dim $s
$s = "<table><tr><td>354</td></tr></table>"
$s = ReplaceRegex($s, "</td>\d+</td>", "</td>-</td>")
' returns $s = "<table><tr><td>-</td></tr></table>"