please help with regex for only 1 url. Meaning, user is not suppose to be able to supply two urls seperated by comma or other seperator. is that possible? what's the best solution? thanks
Asked
Active
Viewed 245 times
0
-
i also found this: http://dataannotationsextensions.org/ – ShaneKm Mar 18 '11 at 15:22
2 Answers
1
There are plenty here: http://www.regexlib.com/Search.aspx?k=url&c=-1&m=5&ps=20
Ensure you add ^ at the beginning to denote the start of the string, and $ to denote the end.
If you only need a single URL, then any other URLs the user adds would make the entire string an invalid URL, so you win.

Town
- 14,706
- 3
- 48
- 72