0

I am validating website by writing serverside regular expression when i copy the same
thing in javascript and try to validate its not happening a part of my code is as follows

"^(https://)+\w+\.+\w" - //serverside validation working fine
document.getElementById('txtWebsite').value.match("^(https://)+\w+\.+\w") == null

how can i implement the same in client side validation

1
  • tag this question as javascript Commented Jan 5, 2011 at 5:34

1 Answer 1

1

String.match is considering you regex as String and not as a RegExp object. Try this:

document.getElementById('txtWebsite').value.match(/^(https:\/\/)+\w+\.+\w/)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.