in reply to pattern matching
#!/usr/bin/perl use strict; use warnings; my $tail = ".D(next_out_en), .CP(n16), .CDN(n48), .Q(\n"; print "Matched: \$1 '$1', \$2: '$2', \$3: '$3'\n" if $tail =~ /^\s*(.+)\s+\.\s*CP\s*\(\s*(\S+)\s*\)\s*\,\s+(.+)\s*\n +/i;
Prints:
Matched: $1 '.D(next_out_en),', $2: 'n16', $3: '.CDN(n48), .Q('
How is your code different? Maybe you don't have a newline at the end of $tail?
|
|---|