Class
RegExMatch
Description
Used to extract the matched string when doing a search with regular expressions.
Properties
Name |
Type |
Read-Only |
Shared |
---|---|---|---|
✓ |
Methods
Name |
Parameters |
Returns |
Shared |
---|---|---|---|
[ReplacementPattern As String] |
|||
matchNumber As Integer |
|||
matchNumer As Integer |
Property descriptions
RegExMatch.SubExpressionCount
SubExpressionCount As Integer
Number of SubExpressions that are available with the search just performed.
Regular Expressions support both
\number
and$number
syntax for SubExpressions.SubExpressions allow replacement of parts of the pattern.
This property is read-only.
Method descriptions
RegExMatch.Replace
Replace([ReplacementPattern As String]) As String
Substitutes the matched result in a manner specified by the given ReplacementPattern.
If no ReplacementPattern is specified, it uses the ReplacementPattern which was specified in the RegEx object at the time of the search.
RegExMatch.SubExpressionStartB
SubExpressionStartB(matchNumber As Integer) As Integer
Returns the starting byte offset of the SubExpression given by matchNumber.
To convert this byte offset into a 1-based character position (for use with String functions such as Mid and Left), use this code:
Var s As String s = theString characterPosition = s.LeftBytes(aRegExMatch.SubExpressionStartB(matchNumber)).Length + 1
RegExMatch.SubExpressionString
SubExpressionString(matchNumer As Integer) As String
Returns the SubExpression as a String for the passed matchNumber.
0 returns the entire MatchString (the implicit 0th SubExpression), and 1 is the first real SubExpression.