natasha_thomas Posted March 10, 2011 Share Posted March 10, 2011 Folks, I want to extract certain portion form URL. Exmaple: http://abc.com/this-is-test.html Output should be this-is-test Another Example http://abc.com/this-is-yet-another-test.html Output should be this-is-yet-another-test I am not sure how it can be done with preg_match() and regex or something like that... Can someone help me with this please? Cheers Natasha Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted March 10, 2011 Share Posted March 10, 2011 You can use parse_url() and trim the extension or I would use: echo pathinfo('http://abc.com/this-is-yet-another-test.html', PATHINFO_FILENAME); Quote Link to comment Share on other sites More sharing options...
natasha_thomas Posted March 10, 2011 Author Share Posted March 10, 2011 You can use parse_url() and trim the extension or I would use: echo pathinfo('http://abc.com/this-is-yet-another-test.html', PATHINFO_FILENAME); Very Sweet.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.