Jump to content

Recommended Posts

Hey Guys,

 

baiscally what I have been trying to accomplish ( i know this will probably be simple but i suck at regex) is to find an occurence of two types of occurences of letters or numbers in a webpage for example 9782378746856  or 078170256X. Each match then needs to be retrieved. I have this, but there is a problem , this problem is that the when some of examples are found they are found with /078170256X and i want to exlude any example that has a / in front of it how could i go about doing this ?

 

Thank you .

 

james

Link to comment
https://forums.phpfreaks.com/topic/246481-matching-s-or-s-before-a-regex/
Share on other sites

Hi James. Use a negative lookbehind.

 

"~(?<!/)$pattern~"

 

But as MarPlo said, post some more info if you'd like a better answer. What's your current regex?

 

Try this website for some help too, http://www.regular-expressions.info/tutorial.html

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.