Struct RXGroup
public struct RXGroup
Remarks
Groups are regular expression parts enclosed in ()
. Except non-capturing parts, like (?:...)
and (?options)
. A RXGroup variable contains info about a group found in the subject string: index, length, substring.
Some groups specified in regular expression may not exist in the subject string even if it matches the regular expression. For example, regular expression "A(\d+)?B"
matches string "AB"
, but group (\d+)
does not exist. Then RXGroup.Exists is false
, RXGroup.Start -1, RXGroup.Length 0, RXGroup.Valuenull
.
When a group matches multiple times, the RXGroup variable contains only the last instance. For example, if subject is "begin 12 345 67 end"
and regular expression is (\d+ )+
, value of group 1 is "67"
. If you need all instances ("12"
, "345"
, "67"
), instead use .NET System.Text.RegularExpressions.Regex and System.Text.RegularExpressions.Group.Captures. Also you can get all instances with regexp.Callout.
Namespace: Au.Types
Assembly: Au.dll
Properties
Name | Description |
---|---|
End | Gets end offset of the group match in the subject string (RXGroup.Start + RXGroup.Length). |
Exists | Returns |
Length | Gets length of the group match in the subject string. |
Span | Gets span of the subject string from RXGroup.Start to RXGroup.End. |
Start | Gets start offset of the group match in the subject string. |
Value | Gets substring of the subject string from RXGroup.Start to RXGroup.End. |
Methods
Name | Description |
---|---|
ToString() | Returns RXGroup.Value. |
Operators
Name | Description |
---|---|
implicit operator Range(RXGroup) |