Tony Serva

Tony Serva

  • NA
  • 11
  • 0

RegEx to get only page name from URL

Sep 23 2008 1:27 PM
Hi, Can anyone help me to understand how to take:,
http://www.mywebsite.com/news/local_news/Bullet-riddled_body_found_on_North_Side.html
And strip off everything before the last "/"
to result in:
Bullet-riddled_body_found_on_North_Side.html
The replace on the ".html" is something I know how to do and I think i need to use:

Regex RE = new
Regex("/",RegexOptions.RightToLeft);
Match theMatch = RE.Match(URL);

But his only returns the character "/".
How do you say delete everything before the first instance of the "/" character looking left to Right?

Thanks in advance.

Answers (9)