PC Nerd Posted January 9, 2009 Share Posted January 9, 2009 Hi, Firstly - I know the most basic of regex, and thats it. Im looking to match the pattern: src="[A-Za-z0-9]" * well at least, thats roughly it. How can I store the patern matched by [A-Za-z0-9], but only in teh context of src="pattern" ? * Im attempting to parse urls on a page, and make them absolute, so i wil be adapting the same code to href etc. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/140144-matching-urls-and-storing-the-actual-url-in-a-variable/ Share on other sites More sharing options...
.josh Posted January 9, 2009 Share Posted January 9, 2009 '~src="([A-Za-z0-9]+)"~' Quote Link to comment https://forums.phpfreaks.com/topic/140144-matching-urls-and-storing-the-actual-url-in-a-variable/#findComment-733289 Share on other sites More sharing options...
PC Nerd Posted January 9, 2009 Author Share Posted January 9, 2009 Ok thanks, So how do I then use that matched pattern? I want to be able to parse only the url into a function, and then replace the function returned value, back into the original string that was matched. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/140144-matching-urls-and-storing-the-actual-url-in-a-variable/#findComment-733308 Share on other sites More sharing options...
.josh Posted January 9, 2009 Share Posted January 9, 2009 preg_replace Quote Link to comment https://forums.phpfreaks.com/topic/140144-matching-urls-and-storing-the-actual-url-in-a-variable/#findComment-733471 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.