Method regexp.FindAll(+ 3 overloads)
Overload
Finds all match instances of the regular expression.
public IEnumerable<RXMatch> FindAll(string s, Range? range = null, RXMatchFlags matchFlags = 0)
Parameters
s (string)
Subject string. Cannot be |
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<RXMatch>
A lazy IEnumerable<RXMatch> that can be used with |
Exceptions
ArgumentNullException
s is |
ArgumentOutOfRangeException
Invalid 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 two22 three333 four";
var x = new regexp(@"\b(\w+?)(\d+)\b");
foreach(var m in x.FindAll(s)) print.it(m.Value, m[1].Value, m[2].Value);
Overload(next)
Finds all match instances of the regular expression.
public IEnumerable<string> FindAll(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<string>
A lazy IEnumerable<string> 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 v in x.FindAll(s, 0)) print.it(v);
Overload(next)
Finds all match instances of the regular expression. Gets array of RXMatch.
public bool FindAll(string s, out RXMatch[] result, Range? range = null, RXMatchFlags matchFlags = 0)
Parameters
s (string)
Subject string. Cannot be |
result (RXMatch[])
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 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 two22 three333 four";
var x = new regexp(@"\b(\w+?)(\d+)\b");
if(!x.FindAll(s, out var a)) { print.it("not found"); return; }
foreach(var m in a) print.it(m.Value, m[1].Value, m[2].Value);
Overload(top)
Finds all match instances of the regular expression. Gets array of strings.
public bool FindAll(string s, int group, out string[] 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 (string[])
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.FindAll(s, 0, out var a)) { print.it("not found"); return; }
foreach(var v in a) print.it(v);