On Sun, 2006-08-13 at 10:48 -0500, Mumia W. wrote: > On 08/13/2006 08:36 AM, Ken Perl wrote: > > what's correct regular expression on extracting only NAME and > > DESCRIPTION section from pod text file? > > I have tried this, but failed! > > > > perl -e '$c=`pod2text /data/WebGUI/lib/WebGUI/User.pm`;$c =~ > > s/(NAME.*)SYNOPSIS/$1/;print $c' > > > > foreach $_ (`pod2text /usr/bin/pod2text `) { > if (/^NAME|SYN/../^$/) { print } > }
Assuming POD is =head1 NAME and =head1 SYN match would be: /^=head[1-4] *(NAME|SYN)/ I think that + would work as well... /^=head[1-4] +(NAME|SYN)/ I tend not to use + because the grep's that I use do not reliably handle them and I cannot remember where they work and where they don't. You might want to add an i to remove case sensitivity. /^=head[1-4] +(NAME|SYN)/i Ta Ken -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>