• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

real quick help with reg ex

f1sh3r

Senior member
i have a blog on one site. id basically just want the titles (with a link) to show up on my personal webpage. i imagine i do this by grabbing info from the rss feed, and displaying it.

i dont have a lot of experience with xml.

anyone have a simple script that does this, or a link to some info? my webpage is in php.

thanks

edit: ...the feed is an Atom feed, and the xml is screwy to deal with...

i need a regex that will lift the link out of this line. can some one help?

<link rel="alternate" href="http://subpopulated.ning.com/x...l/689763:BlogPost:6149"/>

i came up with

#<link.*(http:\/\/.*?)\"/>#s

is that as clean as ill get?
 
Assuming they'll all fit that form, it looks fine. If it's possible you'll have something like:

<link href="www.google.com"/>

then you should obviously modify it.
 
Originally posted by: esun
Assuming they'll all fit that form, it looks fine. If it's possible you'll have something like:

<link href="www.google.com"/>

then you should obviously modify it.

Yeah, I'd probably include https and www at a minimum.

#<link.*(((http(s)?:\/\/)|www).*?)\"/>#s
 
Originally posted by: joshsquall
Originally posted by: esun
Assuming they'll all fit that form, it looks fine. If it's possible you'll have something like:

<link href="www.google.com"/>

then you should obviously modify it.

Yeah, I'd probably include https and www at a minimum.

#<link.*(((http(s)?:\/\/)|www).*?)\"/>#s

Actually, that wasn't the solution I was thinking of. It'd be more like:

/<link.*?href\s*=\s*\"(.*?)\"/

That should be enough. This assumes your links are all quoted, which they should be. If you don't know exactly what the link will look like, it seems much smarter to use the other identifying mark which is href="()".
 
Back
Top