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

Re: [MacPerl] RFC: How can I optimise bulk matching regex



On Tue, Jul 20, 1999 at 06:27:19PM +0900, robinmcf@altern.org wrote:
> I'm currently working on a dictionary project, I'm using -

This code won't compile, and even if it did, you'd be matching the same
term every time through the loop because of the /o.

> @searchterms= qw (
> 	term1
> 	term2
> 	term3
> 	...);
> 
> while (<>) {
>     foreach $item(@searchterms) {
> 	if (/$item\/go) {
> 	    do stuff....;
> 	}
>     }
> }
> 
> -to parse the files I want to check - (the search terms array will get
> bigger as the user dictionary expands). In the regexp faq it says this kind
> of matching is very inefficient and suggest using  MAP to compile the
> regexes, though I have tried I can't adapt the example given for what I
> want to do, and the Camel is (unfortunately in this case) exactly like the
> FAQ .
> Any examples and/or pointers will go a long way to helping my insomnia

Why can't you adapt the example given?  What have you tried?

Let's see some code.


Ronald

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org