how to extract pattern
1. .xxx ( $analog_atop_io[n] ) .or. 2. .ooo ( {$analog _atop_io[m], $analog _atop_io[m+1], $analog _atop_ +io[m+2], …} )
to $analog_atop_io[n], $analog _atop_io[m], $analog _atop_io[m+1], $an +alog _atop_io[m+2], … and then put into array @analog _atop_io
analog_atop u_analog_atop (.PAD_VDDA ( PAD_VDDA ) , , .LNA1_CURSET ( {n_IP_protect_573 , n_IP_protect_572 } ) , .CTL_CXI_XO24M ( {n662 , n447 , n449 , n2478 } ) , .CTL_SYNTH_EN ( n_IP_protect_313 ) , .CTL_CXO_XO24M ( {n2705 , n439 , n441 , n443 } ) , , .DPAD_VSS_TEMPSENSE ( DPAD_VSS_TEMPSENSE ) , .PAD_ADGPIO_2 ( PAD +_ADGPIO_2 ) ) ;
following is my code , but fail to extract ! (nothing captured)
#!/usr/bin/perl #use 5.010; use strict; use warnings; use List::MoreUtils qw(uniq); my $reS = qr{\..* \( (.*) \)}s; my $reM = qr{\..* \( \{ (.*) \} \)}s; #my $re = qr{TEXT;\s+LAYER 13[1-7];\s+TEXTTYPE 0;.*?STRING ([^;:]+)}s; open my $fh, "analog_atop_inst.v" or die $!; my @fields=(); my $i=0; { local $/ = ""; while (<$fh>) { $fields[$i] = $1 , $i++ if /$reM/; } } @fields = sort @fields; @fields = uniq (@fields); open(output_1, ">analog_atop_io".".txt") or die "can't open analog_ato +p_io\n"; foreach my $field (@fields){ $field .= "\n"; print output_1 $field ; #print $field ;
In reply to how to extract multiple pattern into array by herman4016
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |