On Tue, 2006-05-16 at 18:49, Robert Samuel White wrote: > In case any one is looking for a solution to a similar problem as me, here > is the answer. I used the code from my original post as my guiding light, > and with some experimentation, I figured it out. > > To get any URL, regardless of where it is located, use this: > > preg_match_all("#\'http://(.*)\'#U", $content, $matches); > > This match anything similar to: > > 'http://www.domain.com/dir/dir/file.txt?query=blah' > > This is useful, if for example, you have a tag like this one: > > <A HREF="javascript:void(0);" ONCLICK="javascript:window.open = > 'http://www.domain.com/dir/dir/file.txt?query=blah';"> > > Now, for tags which are in quotes, rather than single quotes, just use: > > preg_match_all("#\"http://(.*)\"#U", $content, $matches); I'd roll those two into one expression: preg_match_all("#(\"|')http://(.*)(\"|')#U", $content, $matches); Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php