• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in JavaScript by
Q:
Example Of Using Regular Expressions For Syntax Checking In Javascript

1 Answer

0 votes
by

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.\r\n Should be something like: \"&a=1&c=4\"");

}

Related questions

0 votes
asked Nov 11, 2020 in Linux by sharadyadav1986
0 votes
asked Mar 5 in D Programming by SakshiSharma
...