-2

The text I was going through mentioned that following regular Expression matches any .aspx url:

@"?i:^.*\.aspx.*$"

I couldnot understand what ?i:^ did while matching. Pls. explain what part it matches in urls like http://localhost:2447/Out.aspx, https://msdn.microsoft.com/en-us/library/88c54tsw.aspx.

Tisal
  • 155
  • 1
  • 4
  • 12

1 Answers1

1

?i means ignore case. Your pattern also has some unneeded fillers. If you only want to check if the string contains .aspx, use this:

(?i)\.aspx

// Match:
http://localhost:2447/Out.aspx
http://localhost:2447/Out.AsPx/suburl
https://msdn.microsoft.com/en-us/library/88c54tsw.aspx
Code Different
  • 73,850
  • 14
  • 125
  • 146