I’m trying to get a string from a URL in C#. The URL will look something like this:
http://www.somesite.com/something/I-WANT-THIS-SEGMENT/cms/somethingelse
OR
http://www.somesite.com/something/someotherthing/I-WANT-THIS-SEGMENT/cms
OR
http://www.somesite.com/I-WANT-THIS-SEGMENT/cms/something
Basically, I want the segment before the “cms”
Not so pretty, but I think that you don’t need a regex here:
Using the
Uriclass would be nice too, as George pointed out.