Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Extraneous behaviour of match variables

by explorer (Chaplain)
on Nov 03, 2006 at 08:34 UTC ( [id://582077]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Extraneous behaviour of match variables
in thread Extraneous behaviour of match variables

Thanks, ikegami, for illumination.

A question more. Is better ((?:(?!video).)+) that ((?:(?<!video).)+) ?

  • Comment on Re^2: Extraneous behaviour of match variables

Replies are listed 'Best First'.
Re^3: Extraneous behaviour of match variables
by Fletch (Bishop) on Nov 03, 2006 at 09:30 UTC

    Better might be to use an HTML parser (or something like HTML::LinkExtor) and simplify what you have to look at.

Re^3: Extraneous behaviour of match variables
by ikegami (Patriarch) on Nov 03, 2006 at 10:41 UTC

    (?:(?<!video).)+ is wrong.

    for my $re ( qr/"(?:(?!video).)+"/, qr/"(?:(?<!video).)+"/, qr/"(?:.(?<!video))+"/, ) { print("$re\n"); for ( '"...video..."', '"...video"', '"video..."', '"video"', ) { print("$_: ", /$re/?1:0, "\n"); } }
    (?-xism:"(?:(?!video).)+") "...video...": 0 "...video": 0 "video...": 0 "video": 0 (?-xism:"(?:(?<!video).)+") "...video...": 0 "...video": 1 <----- XXX "video...": 0 "video": 1 <----- XXX (?-xism:"(?:.(?<!video))+") "...video...": 0 "...video": 0 "video...": 0 "video": 0

    (?:(?!video).)+ and (?:.(?<!video))+ should be equivalent. You can do benchmarks to be sure.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://582077]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.