[Pdx-pm] regex regex
Austin Schutz
tex at off.org
Thu Jan 27 10:41:40 PST 2005
On Thu, Jan 27, 2005 at 10:08:15AM -0800, Michael Rasmussen wrote:
> I have a number of scripts that filter directory contents checking for particular file names.
>
> Today I was asked "will a file named PDX200501270800KEYW.msg be processed by one of your scripts?"
>
> In reality the search is easy because I'll look for the program that handles the work for this particular business group.
>
> However, let's say I had to go through a large (i.e., bigger than I want to vgrep) number of
> source files. 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?
well it's a good start, but it's not guaranteed to hit everything.
You have a few problems to cover, such as:
if( /foo/ or /bar/ ) {
m{foo} && ....
s(foo)(bar)
and the multiline /x regexes, like
m/
foo
/x
..but it's a good start. If you have a specific directory of scripts
to look at you can probably test for the existence of all these. But make
sure you cover everything in `perldoc perlre`.
Austin
More information about the Pdx-pm-list
mailing list