jamesmiller Posted September 5, 2011 Share Posted September 5, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/246481-matching-s-or-s-before-a-regex/ Share on other sites More sharing options...
MarPlo Posted September 5, 2011 Share Posted September 5, 2011 Hy, I think you can get a better answer if you post your regexp code, and the function in which you use it. Quote Link to comment https://forums.phpfreaks.com/topic/246481-matching-s-or-s-before-a-regex/#findComment-1265726 Share on other sites More sharing options...
joe92 Posted September 5, 2011 Share Posted September 5, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/246481-matching-s-or-s-before-a-regex/#findComment-1265750 Share on other sites More sharing options...
jamesmiller Posted September 7, 2011 Author Share Posted September 7, 2011 hey, thank you , i am still retreiving from the page the numbers with "/" before them any idea of what needs to be done or improved? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/246481-matching-s-or-s-before-a-regex/#findComment-1266477 Share on other sites More sharing options...
joe92 Posted September 7, 2011 Share Posted September 7, 2011 If you could post your current code it would be a lot easier to help you... Quote Link to comment https://forums.phpfreaks.com/topic/246481-matching-s-or-s-before-a-regex/#findComment-1266503 Share on other sites More sharing options...
xyph Posted September 7, 2011 Share Posted September 7, 2011 We need a much more complete example of data you want to extract. The RegEx required will vary depending on what kinds of characters surround these strings, or if they are isolated on their own. Quote Link to comment https://forums.phpfreaks.com/topic/246481-matching-s-or-s-before-a-regex/#findComment-1266511 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.