$str =~ s/(\w+)'/!$1/g; $str =~ s/\(([^\)]+)\)'/!($1)/g; [download]
In reply to Re^4: Generate a truth table from input string by tachyon-II in thread Generate a truth table from input string by Anonymous Monk