matchFirst

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.
  1. auto matchFirst(R input, RegEx re)
  2. auto matchFirst(R input, String re)
  3. auto matchFirst(R input, String[] re)
    matchFirst
    (
    R
    String
    )
    (,
    String[] re...
    )

Return Value

Type: auto

Captures containing the extent of a match together with all submatches if there was a match, otherwise an empty Captures object.

Meta