Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^2: Boolean operators in PERL regexp?

by lenrobert (Initiate)
on Feb 25, 2005 at 16:25 UTC ( #434545=note: print w/replies, xml ) Need Help??

in reply to Re: Boolean operators in PERL regexp?
in thread Boolean operators in PERL regexp?

Friedo, Enlinl, Ikegami, thank you for your responses.

Yes, my problem might be easily solved with an HTML parser, but beyond my question in my opinion a logical NOT would be essential for regexps. Lookahead and lookbehind assertions are very good, the only fatal problem with them, that they are non-capturing, i.e. I cannot extract non-matching. Maybe there is a reason for this, I don't know.

  • Comment on Re^2: Boolean operators in PERL regexp?

Replies are listed 'Best First'.
Re^3: Boolean operators in PERL regexp?
by ikegami (Pope) on Feb 25, 2005 at 16:30 UTC
    Whatcha talking about?
    NOT /XYZ/ vvvvvvvvvvvvv >perl -e "$_ = 'ABCDEFGHIJKL'; print(/ABC((?:(?!XYZ).)*)JKL/);" DEFGHI
      Ikegami, you're right. As it seems I needed some more help to use your code. Now it works, the final version is:
      /(<a href=("|))((?:(?!("|\/|#|javascript)).)*)(\s|"|>)/gi
      And $3 is the value of the href property.
      Thank you.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://434545]
hippo looks sideways at LiposuctionAnnCure
[Veltro]: I don't understand. I keep getting "your connection is not secure" on https://perlmonks. org. The behaviour is totally random. Then it is insecure and then it is secure again...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2018-05-23 11:13 GMT
Find Nodes?
    Voting Booth?