You might need to obtain more information than just if the regular expression found a match.
( ) | Captures the matched substring (or noncapturing group – see the n option). Captures using () are numbered automatically based on the order of the left parentheses, starting from 1. |
(?<name> ) | Captures the matched substring into a group name or number name. The name must not contain any punctuation. Single quotes can be used as an alterative to the angle brackets; for example, (?'name' ). |
(?: ) | Noncapturing group. |
(?imnsx-imnsx: ) | Applies or disables the specified options within the parentheses. For example, (?i-s: ) turns on case insensitivity and disables single-line mode. See the Regular Expression Options section. |
(?= ) | Zero-width positive lookahead assertion. Continues match only if the subexpression matches at this position on the right. For example, \w+(?=\d) matches a word followed by a digit, without matching the digit. This construct does not backtrack |
(?! ) | Zero-width negative lookahead assertion. Continues match only if the subexpression does not match at this position on the right. For example, \b(?!un)\w+\b matches words that do not begin with "un". |
(?<= ) | Zero-width positive lookbehind assertion. Continues match only if the subexpression matches at this position on the left. For example, (?<=19)99 matches instances of "99" that follow "19". This construct does not backtrack. |
(?<! ) | Zero-width negative lookbehind assertion. Continues match only if the subexpression does not match at this position on the left. |
(?> ) | Nonbacktracking subexpression. The subexpression is fully matched once, and then does not participate piecemeal in backtracking. (That is, the subexpression only matches strings that would be matched by the subexpression alone.) |