Reputation: 73
I need help in getting a regular expresion for the following:
/_layouts/images/ABC.RadToolBarWebPart/add.png
And a url which could be complete or relative. Some examples:
~/Realtime/ABCSoft/Pages/My-Application.aspx
www.xyz.com
http://xyz.com
https://xyz.com
I have tried "/_layouts/images/" + "^[a-zA-z0-9./].[jpg|gif|png]$" for the image and "^[~][/a-zA-Z0-9]+.[aspx|com|net]$" for the URL
Thanks!
Upvotes: 0
Views: 128
Reputation: 100630
Uri and its Uri.Segments will be better option than regular expressions. It will properly handle encodings which you would otherwise need to manually remove...
Upvotes: 2
Reputation: 3049
well the following works for the supplied paths. Not exactly elegant though (add ^ and $ at your discretion).
((https?://)|(~/)|(/)|)(([a-zA-Z .\_-]+)+/?)+
Upvotes: 0