Jump to content

Lookaheads and grouping


marklarah

Recommended Posts

Hey hey dudes

 

So I'm fairly new to regex (I've avoided having to write my own expressions up till now lol)

 

So I have a big expression that matches URLs, but I don't want it to match if it's proceeded by something.

 

To boil it down and put it simply, something like this

([a-z]+)(?!( hi))

with string "hello hi" would match "hell", but how would I make it so it matches nothing? ie how do I put everything else that I'd normally test for together in a group or something, with a conditional that if everything is proceeded by something else, the whole thing returns no matches. Hope I'm making myself clear....

 

Thanks!

 

Mark

Link to comment
https://forums.phpfreaks.com/topic/260303-lookaheads-and-grouping/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.