HomeConditional Patterns
Conditional Patterns
Logic-based matching.
23 Tools Available
Alternation (OR)
Matches "cat" OR "dog".
/cat|dog/
Optional "s"
Matches "http" OR "https".
/https?/
Conditional Group
Matches one of the file types.
/(jpg|png|gif)/
Start OR End
Matches if at start OR end.
/^start|end$/
Include OR Exclude
Matches "include" unless followed by "_exclude".
/include(?!_exclude)/
Preceded By
Matches "fix" only if preceded by "pre".
/(?<=pre)fix/
Not Preceded By
Matches "do" only if NOT preceded by "un".
/(?<!un)do/
Followed By
Matches "val" only if followed by "id".
/val(?=id)/
Not Followed By
Matches "val" only if NOT followed by "id".
/val(?!id)/
Mixed Logic
Matches "ac" OR "bc".
/(a|b)c/
Protocol Logic
Matches various protocols.
/(http|ftp|mailto):/
Boolean String
Matches boolean strings.
/true|false/
Case Variation
Matches "Case" OR "case".
/[Cc]ase/
Quote Style
Matches double OR single quoted strings.
/"[^"]*"|'[^']*'/
Number or Word
Matches digits OR words.
/\d+|\w+/
Date Separator
Matches slash OR dash separator.
/\d{2}[/-]\d{2}/
Whitespace Logic
Matches space OR comma+space.
/\s+|,\s*/
Yes/No/Maybe
Matches logic options.
/yes|no|maybe/
On/Off Switch
Matches state.
/on|off/
Pass/Fail
Matches result.
/pass|fail/
High/Low/Medium
Matches levels.
/high|low|medium/
Accept/Reject
Matches actions.
/accept|reject/
Protocol Port
Matches protocols and ports.
/(http|https):\/\/[^:]+:(\d+)/