if there was a match, otherwise an empty Captures object.
matchFirst
fn
auto matchFirst(R, RegEx)(R input, RegEx re) if (isSomeString!R && isRegexFor!(RegEx, R))Find the first (leftmost) slice of the input that matches the pattern re. This function picks the most suitable regular expression engine depending on the pattern properties.
re parameter can be one of three types:
- Plain string(s), 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.
Returns
fn
auto matchFirst(R, String)(R input, String re) if (isSomeString!R && isSomeString!String)ditto
fn
auto matchFirst(R, String)(R input, String[] re...) if (isSomeString!R && isSomeString!String)ditto