It is not that simple I suppose. But ikegami code works great.
my $Line = "1243 That will efficiently match a nonempty group with mat +ching parentheses two levels deep or less."; if ($Line =~ /^(?!.*\bgroup\b)(\d{4}) ([^.]+?[.\!\?])$/){ print "$1\n$2\n"; #Does not print } elsif ($Line =~ /^(?!.*\bgXroup\b)(\d{4}) ([^.]+?[.\!\?])$/){ print "$1\n$2\n"; #Prints }
Though it solves my original query just wondering if it is possible to check the word in the second group of (). Thanks ramprasad27 for the "\." point. I didnt know that earlier.
-DominicIn reply to Re^3: Excluding Words in RegEx
by dominic01
in thread Excluding Words in RegEx
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |