Community Patterns

Community Library Entry

1

Regular Expression
Created·2024-07-15 22:20
Updated·2024-07-29 21:57
Flavor·PCRE2 (PHP)

/
^(?P<WFF>(?P<L>~*(?>[A-Z\^!]|\(\g<WFF>\)))(?(?=\$)\$\g<L>|(?:(?P<O>[\%&|])(?:\g<L>\k<O>)*\g<L>)?))$
/
gx
Open regex in editor

Description

Matches strings that are Well-formed-formulas in Propositional with the following symbols {⊤,⊥,∧,∨,¬,→,↔} This matches with formulas that are looser then defined by formal syntax (See https://en.wikipedia.org/wiki/Well-formed_formula#Propositional_calculus). Namely, it's able to match with > No External Parenthesis > Generalized Conjunction, Disjunction, & Biconditional

Submitted by Gabriel Weredyk