matchFirst

fnauto 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

Captures containing the extent of a match together with all submatches

if there was a match, otherwise an empty Captures object.

fnauto matchFirst(R, String)(R input, String re) if (isSomeString!R && isSomeString!String)

ditto

fnauto matchFirst(R, String)(R input, String[] re...) if (isSomeString!R && isSomeString!String)

ditto