if you are building for speed avoid $&, $' and $` as they make copies of
the variable being manipulated (see Freidl's  Mastering Regular Expressions
ppgs. 273-278 and 281-282).

"you could try changing your substitute to a match and either using parens
with $1 $2 and so on or you could use
$& with $` (back tick) and $' (forward tick)"



                                                                                       
                                       
                    Mark Meyer <[EMAIL PROTECTED]>                                         
                                       
                    Sent by:                                     To:     
"Perl-win32-users (E-mail)"                          
                    [EMAIL PROTECTED]        
<[EMAIL PROTECTED]>                  
                    eState.com                                   cc:                   
                                       
                                                                 Subject:     RE: I 
need Faster way than s/bla/bla/i to       
                                                                 remove string. Does 
tha t exist?                             
                    02/28/01 06:12 PM                                                  
                                       
                                                                                       
                                       
                                                                                       
                                       


> Is there a faster way to remove the javascripts (of a HTML
> file put in a
> $string var) than mine?
> It's for a Html search engine.
>
> Here are what I do:
>
> $string =~ s/.*<[\s]*script.*>.*<[\s]*\/script>//ie;
>
> It is because I do not want to find text which is inside the
> javascripts.
>


i don't have time to work with this at the moment - but i can make a
suggestion:

why not change the goal from:

"I want to get rid of everything in between a leading and ending marker"
to...

"i want to keep everything before and after a leading and ending marker"

you could try changing your substitute to a match and either using parens
with $1 $2 and so on or you could use
$& with $` (back tick) and $' (forward tick)

hth
mark
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users




_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to