amites Posted October 2, 2008 Share Posted October 2, 2008 Hello, I'm working on a script to auto parse URL's in text, I have the URL match working, unfortunately it is parsing existing links and image links as well, anyone have some advice? preg_match('/\\bhttps?:\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]/i', $content) I tried adding (!=") and it simply ignores the last character of the match, what I want it to do id ignore matches inside quotation marks " any ideas are greatly appreciated Quote Link to comment https://forums.phpfreaks.com/topic/126797-match-url-not-inside-tag/ Share on other sites More sharing options...
genericnumber1 Posted October 2, 2008 Share Posted October 2, 2008 a logical "not" in regex is [^chars] so for you it would likely be [^"] or [^"'] to make sure there isn't a quote in a certain section of text. Quote Link to comment https://forums.phpfreaks.com/topic/126797-match-url-not-inside-tag/#findComment-655872 Share on other sites More sharing options...
amites Posted October 2, 2008 Author Share Posted October 2, 2008 I'm not looking to keep " from being in the match, I want to keep from matching something inside "" so http://www.someurl.com will match <a href="http://www.someurl.com"> will not make sense? Quote Link to comment https://forums.phpfreaks.com/topic/126797-match-url-not-inside-tag/#findComment-655876 Share on other sites More sharing options...
effigy Posted October 2, 2008 Share Posted October 2, 2008 You need to isolate the HTML, similar to this. Quote Link to comment https://forums.phpfreaks.com/topic/126797-match-url-not-inside-tag/#findComment-655885 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.