View source code Display the source code in std/regex.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

Function std.regex.matchAll

Initiate a search for all non-overlapping matches to the pattern re in the given input. The result is a lazy range of matches generated as they are encountered in the input going left to right.

This function picks the most suitable regular expression engine depending on the pattern properties.

re parameter can be one of three types:

  • Plain string, in which case it's compiled to bytecode before matching.
  • Regex!char (wchar/dchar) that contains a pattern in the form of compiled bytecode.
  • StaticRegex!char (wchar/dchar) that contains a pattern in the form of compiled native machine code.

Prototypes

auto matchAll(R, RegEx)(
  R input,
  RegEx re
)
if (isSomeString!R && is(RegEx == Regex!(BasicElementOf!R)));

auto matchAll(R, String)(
  R input,
  String re
)
if (isSomeString!R && isSomeString!String);

Returns

RegexMatch object that represents matcher state after the first match was found or an empty one if not present.

Authors

Dmitry Olshansky,

API and utility constructs are modeled after the original std.regex by Walter Bright and Andrei Alexandrescu.

License

Boost License 1.0.

Comments