Regular Expression to Separate the Anchor Part of a URL


/ Published in: C#
Save to your folder(s)

Dots match any charecter, this matches any 7 chars. You need to change that bit to match a different pattern.


Copy this code and paste it in your HTML
  1. private string GetAnchorPart()
  2. {
  3. string anchorExp = "[#].......";
  4. Regex rex = new Regex(anchorExp);
  5. Match anchorMatch = rex.Match(Request.RawUrl);
  6. return anchorMatch.ToString();
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.