develooper Front page | perl.beginners | Postings from August 2003

Re: nested pattern match

Thread Previous | Thread Next
From:
Raghupathy
Date:
August 1, 2003 13:44
Subject:
Re: nested pattern match
Message ID:
20030801204430.31267.qmail@web40606.mail.yahoo.com
Rob and David,

  Thanks very much! That's exactly what I am looking
for and sorry for the misleading subject on the email.


Rob: Could you please explain why you need 2 questions
marks on line#7 instead of just one minimal quantifier
needed  (I hope I am using the right words this time
!!!).

Thanks,
Ramesh

1 while ( $code =~ m{
2    \#(ifn?def) \s+ def \s* \n
3    (.*?) \s+
4    (?:
5    \#else \s+ def \s* \n
6    (.*?) \s+
7    )??   
8    \#endif \s+ def \s* \n
9  }isxg ) {

10  my ($def, $undef) = $1 eq 'ifdef' ? ($2, $3 
11  || '') : ($3 || '', $2);

12  printf "  Defined: %s\n", $def;
13  printf "Undefined: %s\n", $undef;
14  print "\n";
}




__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About