Posts

Showing posts from November, 2013

Understanding Regular Expressions

Will discuss about basic regular expression in three stages.

Stage 1 SymbolExplanation

^                       Start of string
                      End of string
.                        Any single character
+                       One or more character
\                        Escape Special characters
?                       Zero or more characters

Input exactly match with “abc” 
var A = /^abc$/;
Input start with “abc”
var B = /^abc/;
Input end with “abc”
var C = /abc$/;
Input “abc” and one character allowed Eg. abcx
var D = /^abc.$/;
Input  “abc” and more than one character allowed Eg. abcxy
var E = /