I am trying to analyze a formula and present it on the screen. For instance, I want to be able to input <path>T Q
, where <path>T
remains unchanged, and Q
is a variable. It accepts this input, but when displaying it on the screen, only T Q
shows up. I need <path>T Q
to display in its entirety.
Here are some other examples of accepted formulas:
(B & A)
~A
~(B&A)
<path>T (B & A)
and so on...
The code I'm using looks something like this:
var beginPartBUC = '^<path>\\(',
beginPart = '^\(',
unaryPart = '(?:~|<path>T)',
propOrBinaryPart = '(?:\\w+|\\(.*\\))',
subwffPart = unaryPart + '*' + propOrBinaryPart,
endPart = '\\)$';
// Regular expressions for binary connectives
var conjRegEx = new RegExp(beginPart + '(' + subwffPart + ')&(' + subwffPart + ')' + endPart), // (p&q)
implRegEx = new RegExp(beginPart + '(' + subwffPart + ')->(' + subwffPart + ')' + endPart), // (p->q)
equiRegEx = new RegExp(beginPart + '(' + subwffPart + ')<->(' + subwffPart + ')' + endPart); // (p<->q)
// untilRegEx = new RegExp(beginPartBUC + '(' + subwffPart + ')U(' + subwffPart + ')' + endPart); //<path>(p U q))