Janek, et al --

...and then Janek Schleicher said...
% 
% Nikola Janceski wrote at Fri, 07 Jun 2002 15:02:22 +0200:
% 
% > perhaps use qr// to "precompile" the search instead and use that new precompiled 
var within your
% > loop so you don't evaluate the if conditions each looptime.
...
% 
% Even in the above there's much redundancies and 
% it's hard to maintain.

I saw that and figured there would be a better way to pre-build stuff.


% I think we should exploit the power of Perl:

Good idea!


% 
% for ($pattern) {
%     $_ = "\($_\)";         #  Capturing
%     $_ = "(?i)$_"          if $IgnoreCase;
%     $_ = '^' . $_ . '$'    if $WholeMatchOnly;
% }
% 
% print "matches" if $text =~ /$pattern/;

Ahhhh...  Now *that* looks good.  I can work with that!

I see how the initial capture works.

I see how the wholematch concatenation works.

I'm not sure about the ignore case...  If I read it right, some $pattern
will become "(?i)$pattern".  I guess, then, (?i)pat is like /pat/i
otherwise?


% 
% Now it's exactly expressed what the algorithm has to do:
% Take a pattern {
%    Capture the content
%    IgnoreCase if neccessary
%    WholeMatchOnly if necessary
% }

Exactly.  Thanks a bunch!


% 
% 
% Greetings,
% Janek
% 
% -- 
% To unsubscribe, e-mail: [EMAIL PROTECTED]
% For additional commands, e-mail: [EMAIL PROTECTED]


HAND

:-D
-- 
David T-G                      * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: msg25613/pgp00000.pgp
Description: PGP signature

Reply via email to