REGEX and URL help please
Posted: Sun Jul 30, 2006 12:58 pm
One of the sites I'm building would greatly benefit from a specific RSS newsfeed. Within this newsfeed, there are links to specific sections of the source site's main page.
href="http://www.RSSsourceSite.com/#newsItem"
For some reason, these links produce a page error when followed from the site I'm developing. Rather than trying to figure out why they break, I would like to just trim off the "#newsItem" part. That way, users may not get directly to a specific area of a specific page, but at least they get to the right page.
So:
http://www.RSSsourceSite.com/#newsItem
The underlined part will always be the same. The bold part could be any combination of letters, numbers, or URL-friendly characters. With the correct regex, I can preg_replace and:
http://www.RSSsourceSite.com/#newsItem
- becomes -
http://www.RSSsourceSite.com/
I suck at REGEX, and it gives me a headache. Can anyone help?
Thanks in advance
Siv
href="http://www.RSSsourceSite.com/#newsItem"
For some reason, these links produce a page error when followed from the site I'm developing. Rather than trying to figure out why they break, I would like to just trim off the "#newsItem" part. That way, users may not get directly to a specific area of a specific page, but at least they get to the right page.
So:
http://www.RSSsourceSite.com/#newsItem
The underlined part will always be the same. The bold part could be any combination of letters, numbers, or URL-friendly characters. With the correct regex, I can preg_replace and:
http://www.RSSsourceSite.com/#newsItem
- becomes -
http://www.RSSsourceSite.com/
I suck at REGEX, and it gives me a headache. Can anyone help?
Thanks in advance
Siv