• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
preg match help

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 http://www.tinyurl.com/[what tinyURL creates] and want to grab those links out of a string of text.


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

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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.