in reply to Regex matching and substitution
Prints:#!/usr/bin/perl use strict; use warnings; my $x = '((A & B)\' | (A & C & (A & B & D)\'))'; print "Given: $x\n"; my ($find)= $x=~/([^()]+?)\)/; print "FInd:$find\n"; $x =~ s/$find/!$find/g; print "Calculated: ",$x,"\n";
I could not understand the logic of your substitution requirement.Given: ((A & B)' | (A & C & (A & B & D)')) FInd:A & B Calculated: ((!A & B)' | (A & C & (!A & B & D)'))
"I can cast out either one of your demons, but not both of them." -- the XORcist
|
|---|