Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
(?> (?P<L> ¬? (?> [A-Z⊥]| \((?R)\) ) )[↔∧∨→])?\g<L>
/
gx

Description

Matches a string if the string represents a Well-Formed-Formula in a Truth-Functional-Logic with the symbols {⊥, ¬, ∧, ∨, →, ↔} The rules are as follows: https://en.wikipedia.org/wiki/Well-formed_formula#Propositional_calculus (Outside parenthesis are omitted)

Submitted by Gbariel Weredyk - 3 months ago