ReplaceRegex

Top  Previous  Next

function ReplaceRegex(sSource As String, sSearchRegexStr As String, sReplaceStr As String) As String

 

Returns a string in which a specified substring (defined with a Regular Expression) has been replaced with another substring. This function replaces all found matches.

 

ReplaceRegex is case-insensitive.

 

Parameters

 

sSource ... String expression containing substring to replace.
sSearchRegexStr ... Regular Expression being searched for.
sReplaceStr ... Replacement substring.

 

Example:

Dim s

 

= "<table><tr><td>354</td></tr></table>"

= ReplaceRegex(s, "</td>\d+</td>", "</td>-</td>")

' returns s = "<table><tr><td>-</td></tr></table>"




Translate document: