|Replies are listed 'Best First'.|
Re^3: Regex AND
by ady (Deacon) on Dec 02, 2004 at 17:04 UTC
I could do that, but i prefer a way to express the regex complement directly as a new regex (to be fed to the program). -- And the way to do that was shown by Corion above.
Best regards / allan
... then again, yes i could modify the GUI with a checkbox indicating "straight/negated", and switch the perl comparison operator accordingly. In the end i guess i was intrigued by the "how to climb it", as a regex...
(Update: See Re: Ways to implement a closure for more on using closures for this kind of thing.)
Well, i'd have to open the perl program and change the !~ op to the =~ op each time i want filtering on a "negated domain".Another option would be use "regex matchers" instead of hand-coded regex operations. The matchers can be inverted, and so you can change the matching logic of your worker code by passing in normal or inverted matchers.
One possible implementation:
Then we can parameterize our code's matching behavior by using matchers instead of regex operators:
Here is a sample run:
I hope that this helps.