Example of using Regular Expressions for syntax checking in JavaScript?
Submitted by: Administratorvar re = new RegExp(" ^(&[A-Za-z_0-9]{1,}=[A-Za-z_0-9]{1,})*$" )
<br>var text = myWidget.value
<br>var OK = re.test(text)
<br>if( ! OK ) {
<br>alert(" The extra parameters need some work.
Should be something like: " &a=1&c=4" " ) <br>} <br>
Submitted by: Administrator
Should be something like: " &a=1&c=4" " ) <br>} <br>
Submitted by: Administrator
Read Online JavaScript Job Interview Questions And Answers
Top JavaScript Questions
☺ | Are Java and JavaScript the Same? |
☺ | Explain unescape() and escape() in JavaScript? |
☺ | How to make elements invisible? |
☺ | How to test for bad numbers using JavaScript? |
☺ | What is the difference between an alert box and a confirmation box? |
Top Top World Wide Web Categories
☺ | Cascading Style Sheet CSS Interview Questions. |
☺ | HTML5 Interview Questions. |
☺ | Basic Internet Interview Questions. |
☺ | Domain Name System (DNS) Interview Questions. |
☺ | JavaScript Interview Questions. |