CodeIgniter Forums
preg match help - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: preg match help (/thread-9198.html)

preg match help - El Forum - 06-16-2008

Does anyone have a function on hand for parsing text for links that being with http, www, and grabbing the matches?

I have a bunch of links on my page that begin with[what tinyURL creates] and want to grab those links out of a string of text.

preg match help - El Forum - 06-16-2008


Try that, just add http to the beginning of every match.
Might not work, i dont use preg much.

preg match help - El Forum - 06-17-2008

you pretty much wrote the regex yourself!


that means look for the whole tiny url domain with http:// and then capture anything that is not a space character. this won't work if the urls are in hrefs (as in the urls are in HTML code rather than straight txt) because typically the href uses double quotes to delimit the end of the url. in that case you should be able to just replace the \s with ".

with that in preg_match function you'll have the tinyurl string in array item 1.

let us know.