We still seem to have trouble getting the regex to work correctly!
Here is the original expression:
my $x ='((A & B)\' | (A & C & (A & B & D | (A & (B\' & D)\')\'))';
From the original value of $x printed above, we have to create the following slightly modified expression, like below:
(!(A & B) | (A & C & (A & B & D | !(A & !(!B & D))))
Our Perl program looks like this right now:
#!/usr/bin/perl use strict; use warnings; my $x = '((A & B)\' | (A & C & (A & B & D | (A & (B\' & D)\')\'))'; print "Given: $x\n"; $x =~ s/(\(\s*[^()]+\s*\))\'/\!$1/g; print "Calculated: ",$x,"\n"; $x =~s/([a-zA-Z]\w*)\'/\!$1/g; $x =~ s/((\(){1}\s*.*?([!][(])+.*?\)\s*)\'/\!$1/g; print "NewVl : ",$x,"\n";
I think we have to get it right on how to handle the nested ' single code character (BTW, ' is for representing negation of a value or a logical expression in one tool and we are trying to replace that single quote character to ! character, which is needed in another tool, and print it like stated above).
Thanks for the continued huge help. BillIn reply to Still having trouble with regexes! Please help by Learning_Perl_2017
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |