Having trouble deleting characters from a string. The following code deletes nothing from the incoming string:
Dim sIn As String = “xx405y”
dim rx as new RegEx
rx.SearchPattern = “/[^0-9]/”
rx.ReplacementPattern = “”
rx.Options.ReplaceAllMatches = true
Dim sOut as String
sOut= rx.Replace( sIn) 'Delete Non-Numeric characters
sOut should equal “405” but it is still “xx405y”. What am I missing? Is there a better way to do this?
dim rx as new RegEx
rx.SearchPattern = "(?mi-Us)\d+([.,]\d+)?"
dim rxOptions as RegExOptions = rx.Options
rxOptions.MatchEmpty = false
rxOptions.StringBeginIsLineBegin = false
rxOptions.StringEndIsLineEnd = false
dim match as RegExMatch = rx.Search( sourceText )
while match isa RegExMatch
//
// Do something like myVar = match.SubExpressionString(0).ToDouble
//
match = rx.Search // Fetch the next match
wend