[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: regexp q.



On Wed, Jul 16, 2008 at 09:45:03PM +0200, Florian Kulzer wrote:

...

> 
> The insane approach (dedicated to Andrew S-W, who is a great perl
> aficionado):
> 
> #! /usr/bin/perl -w
> 
> #read file
> open ( FH, "test.txt" );
> $string = <FH>;
> close ( FH );
> 
> # match and count
> while ( $string =~ /('(\\'|[^'\\])*'|(\\'|[^'\\)])*|\)[^,\\]|\),[^(])*\),\(/g ) { $count++ }
> print "$count\n"
> 

gak my eyes bleed!

;-P

A


Reply to: