[RESOLVED] Detect various web site link formats in textarea - no strip, no replace
Hi all,
I'd like to detect, but not remove, not replace/strip, various formats for web site url's. Such as:
http://www.a.com
http://a.com
http:// www . a . com
http : // www a dot com
www.a.com
www . a . com
www dot a dot com
I've tried these, but they don't work:
Code:
var strFindWebSites=/^\(?[http]\)?[\. ]?[www][\. ]?[com]$/g;
if (strFindWebSites.test(theForm.theTextArea.value)) {
...
Code:
var strFindWebSites=/^\(?([http])\)?[\. ]?([www])[\. ]?([com])$/g;
if (strFindWebSites.test(theForm.theTextArea.value)) {
...
Code:
var strFindWebSites=/^\(?(http)\)?[\. ]?(www)[\. ]?(com)$/g;
if (strFindWebSites.test(theForm.theTextArea.value)) {
...
I realize that there are so many ways that people could enter a web site address, and I'm not trying to capture every possible way. Simply trying to capture the more common ways, and those that would include a space in them.
I'm not looking for domain forwards or domain error handling.
Just wanting to detect if anyone has inputed any textarea information that contains a web site address, as above.
Ideas?
Thanks.