-1

I have a URL, for example: http://www.di.fm/calendar/event/40351

I want to parse this URL with a regular expression, and retrieve the part after domain. In this case :calendar/event/40351

There can also be additional information after a hash: (e.g., calendar/event/40351#event-info)

3
  • 1
    Is it this specific domain you need to handle, or any arbitrary domain? Commented Oct 10, 2014 at 15:51
  • arbitrary domain,.. some string for example Commented Oct 10, 2014 at 15:52
  • 1
    This is no simple question, and you would be better off not using a regex. The linked question has some answers, though. Commented Oct 10, 2014 at 15:54

1 Answer 1

8

You don't need Regex:

var uri = new Uri("http://www.di.fm/calendar/event/40351#123");
var result = uri.PathAndQuery + uri.Fragment;
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.