×
Home About Us Products Services News Free Scripts Contact
news php scripts and software

JavaScript & DHTML example - How to write a JavaScript function which checks for special symbols with regular expression?


JavaScript & DHTML - How to write a JavaScript function which checks for special symbols with regular expression?

<script>


function ContainsSpecialSymbols(strInput)
{
		
  // put here whatever symbols you might need to check
  var reg = new RegExp("#|%");

 if (reg.test(strInput))
 {

    return true;
	
 }
  else
  {
		
    return false;
  
  }

}

alert(""+ContainsSpecialSymbols("exam#mple"));

Category: JavaScript & DHTML

 
<< Go back