Branch based on whether a group matched.

Section: PCRE and Advanced Features

Conditional expression

regex
regex
^(?:(<))?\w+(?(1)>)$
Explanation

Useful for optional paired delimiters in PCRE-like engines.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing PCRE and Advanced Features
Atomic group in PCRE
Avoid backtracking inside a grouped token.
OpenIn sheetregexsame section
Subroutine call
Reuse part of the pattern as a subroutine.
OpenIn sheetregexsame section
Recursion
Recursive pattern for balanced parentheses.
OpenIn sheetregexsame section
Keep out / skip fail
Skip over matched prefixes before continuing.
OpenIn sheetregexsame section
grep whole word
Find full-word matches in files.
Reformat date
Convert YYYY-MM-DD into MM/DD/YYYY.