I've been learning some regex as I am trying to create a field that validates a proper website, not allowing for whitespace.
I currently have:
^((http|https|ftp)\://)?(www\.[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*[^\.\,\)\(\s])$
"www.google.com" PASS
"www.goo gle.com" FAIL
" www.google.com" FAIL
However
" " PASS
I thought by adding 'only begin with http|https|ftp' this would ensure the whitespace would not happen, and have even prefixed with [^\s]
- but to no avail.
If it helps I am using the ASP.NET WebForms RegularExpressionValidator control.