Method regexp.FindAllG(+ 1 overload)
Overload
Finds all match instances of the regular expression.
public IEnumerable<RXGroup> FindAllG(string s, int group, Range? range = null, RXMatchFlags matchFlags = 0)
Parameters
s (string)
Subject string. Cannot be |
group (int)
Group number (1-based index) of results. If 0 - whole match. See also regexp.GetGroupNumberOf. |
range (Range?)
Start and end offsets in the subject string. If |
matchFlags (RXMatchFlags)
Options. The same options also can be set in regexp constructor's flags. Constructor's flags and matchFlags are added, which means that matchFlags cannot unset flags set by constructor. |
Returns
IEnumerable<RXGroup>
A lazy IEnumerable<RXGroup> that can be used with |
Exceptions
ArgumentNullException
s is |
ArgumentOutOfRangeException
Invalid group or range. |
ArgumentException
|
AuException
The PCRE API function pcre2_match failed. Unlikely. |
Remarks
This function is similar to System.Text.RegularExpressions.Regex.Matches.
Examples
var s = "one two three";
var x = new regexp(@"\b\w+\b");
foreach(var g in x.FindAllG(s, 0)) print.it(g.Start, g.Value);
Overload(top)
Finds all match instances of the regular expression. Gets array of RXGroup (index, length, value).
public bool FindAllG(string s, int group, out RXGroup[] result, Range? range = null, RXMatchFlags matchFlags = 0)
Parameters
s (string)
Subject string. Cannot be |
group (int)
Group number (1-based index) of results. If 0 - whole match. See also regexp.GetGroupNumberOf. |
result (RXGroup[])
Receives all found matches. |
range (Range?)
Start and end offsets in the subject string. If |
matchFlags (RXMatchFlags)
Options. The same options also can be set in regexp constructor's flags. Constructor's flags and matchFlags are added, which means that matchFlags cannot unset flags set by constructor. |
Returns
bool
|
Exceptions
ArgumentNullException
s is |
ArgumentOutOfRangeException
Invalid group or range. |
ArgumentException
|
AuException
The PCRE API function pcre2_match failed. Unlikely. |
Remarks
This function is similar to System.Text.RegularExpressions.Regex.Matches.
Examples
var s = "one two three";
var x = new regexp(@"\b\w+\b");
if(!x.FindAllG(s, 0, out var a)) { print.it("not found"); return; }
foreach(var g in a) print.it(g.Start, g.Value);