Web Technologies
Java Script Validations
Smt M.Jeevana Sujitha
Assistant Professor
Department of Computer Science and Engineering
SRKR Engineering College, Bhimavaram, A.P. - 534204
OBJECTIVES
The Objectives of this lecture are
Java Script Validations
powerful pattern matching and
to perform search-and-
replace functions on text.
var patt=/pattern/modifiers;
Java Script Validations
Character | Description |
$ | Matches end of string line |
/…./ | All regular expressions start and end with forward slashes |
^ | Matches the beginning of the string or line |
\w+ or [A-Z a-z 0-9 _] | Matches one or more characters including the underscore |
? | Matches the previous character zero or 1 time |
* | Matches the previous character 0 or more times |
@ | It matches only @ character |
\.\w{2,3} | It matches a “.” Followed by 2 or 3 characters. Ex: .edu |
Java Script Validations
Character | Description |
+ | This sign specifies above sub expression occurs one or more times |
Example:
var email=/^[a-z A-Z 0-9 . _ -]+@[a-z A-Z
.]+\.[a-z A-Z] {2,4}$/
var phone=/^\d{10}$/;
Java Script Validations
THANK YOU