I am trying to create a regular expression that picks out a boolean algebra identity, specifically ((A+B).(A+C)), where A, B and C are different strings consisting of characters [A-Z]. I am running into problems getting the regular expression recognise that in the string I am looking for A != B != C. Here is what I have tried:
\(\(([A-Z]+)\+([A-Z])\)\.\(\1\+([A-Z])\)\)
however, even though I have put every string that I want to be different in a capturing group, it doesn't stop it from thinking that strings B and C are the same. This is because the regular expression matches for all three of the following strings:
- ((A+B).(A+C))
- ((A+B).(A+A))
- ((A+A).(A+A))
while I only want it to match the first one.