Expert JavaScript Developer Question: Download Expert JavaScript Developer PDF

Example of using Regular Expressions for syntax checking in JavaScript?

Tweet Share WhatsApp

Answer:

var re = new RegExp(" ^(&[A-Za-z_0-9]{1,}=[A-Za-z_0-9]{1,})*$" )
var text = myWidget.value
var OK = re.test(text)
if( ! OK ) {
alert(" The extra parameters need some work. Should be something like: " &a=1&c=4" " )
}

Download Expert JavaScript Developer PDF Read All 58 Expert JavaScript Developer Questions
Previous QuestionNext Question
What are fixed-width table and its advantages in JavaScript?How to add Buttons in JavaScript?