lundi 9 mars 2015

Perl regex matching is not working in my code



I have a very large file that contains lines like below:



NO BIOMETRICS: 2000 ARIZONA/PHOENIX[1] {ARIZONA_PHOENIX_1_} AI
NO BIOMETRICS: 2090 ARIZONA/PHOENIX[2] {ARIZONA_PHOENIX_2_INTER} AB
NO BIOMETRICS: 900 TEXAS/DALLAS__1 {TEXAS_DALLAS_1_} NOCRIMINALHIST
NO BIOMETRICS: 0002 ALABAMA/HUNTSVILLE {ALABAMA/HUNTSVILLE} STATEPENITENTIARY


I only want to print only when my regular expression does not match ARIZONA




I am using the following code to print all cases where there is no ARIZONA in the rows I am processing



if($line =~ /(?!ARIZONA)/) {
print $line,"\n";
}




but that does not seem to work and it still prints the rows that have ARIZONA in them.


What am i doing wrong?


Thanks.


Aucun commentaire:

Enregistrer un commentaire