[Pdx-pm] regex regex

Ovid publiustemp-pdxpm at yahoo.com
Thu Jan 27 10:17:13 PST 2005


--- Michael Rasmussen <mikeraz at patch.com> wrote:
> I'd want a program to look for regexes and then see if
> this filename would
> match.
> 
> So I need a regex to find regexes.  Or do I?  Perhaps search for
> m|(/.*?/)| and then
> strip the /s and eval the remainder.
> 
> Comments?

Comments?  Hmm ... let's see.  You want to grab Perl code at random,
eval it, and see if it does what you want.

What could possibly go wrong? :)

See if you can figure out PPI
(http://search.cpan.org/~adamk/PPI-0.900/)

This is a pure Perl parser for Perl.  Out of over 38,000 files on the
CPAN, it only chokes on 28.  It's very robust.  You could use that to
much more reliably pull out regexen.  However, be sure to be careful
with that.

  if ($oops -~ /.*(?{system("rm -fr /")})/) {
    collect_pinkslip();
  }

Cheers,
Ovid

=====
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/


More information about the Pdx-pm-list mailing list