Class

RegExMatch


Description

Used to extract the matched string when doing a search with regular expressions.

Properties

Name

Type

Read-Only

Shared

SubExpressionCount

Integer

Methods

Name

Parameters

Returns

Shared

Replace

[ReplacementPattern As String]

String

SubExpressionStartB

matchNumber As Integer

Integer

SubExpressionString

matchNumer As Integer

String

Property descriptions


RegExMatch.SubExpressionCount

SubExpressionCount As Integer

Number of SubExpressions that are available with the search just performed.

This property is read-only.

Regular Expressions support both number and $number syntax for SubExpressions.

SubExpressions allow replacement of parts of the pattern.

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. SubExpressionStartB is zero-based.

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 m As MemoryBlock
m = theString
characterPosition = m.LeftB(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.

Compatibility

All project types on all supported operating systems.

See also

Object parent class; RegEx class.