A
Arpan
Using RegularExpression, the following TextBox ensures that users enter
a valid e-mail address which has a '@' & ends with ".com":
<asp:TextBox id="txtEMail" runat="server"/>
<asp:RegularExpressionValidator ControlToValidate="txtEMail"
ValidationExpression="\w+\@\w+\.com" ErrorMessage="Invalid Email ID"
runat="server"/>
I have gone through many articles on RegularExpressions available on
the Net but have never come across the "w" RegularExpression character.
I know what the other RegularExpression characters used above do but
what is this "w"? What does "w" mean here"? Does it signify a word
(which can be just about anything)?
Similarly, consider the following RegularExpression:
href\\s*=\\s*(\"([^\"]*)\"|(\\S+))
The above RegularExpression means 'href' followed by zero or more white
spaces (\s*), then by '=', then by zero or more white spaces again.
This is then followed by a double quote (\"), then by zero or more
occurences of anything that's not a double quote ([^\"]*), followed by
a double quote 'or' one or more non-white space characters (\S+).
Like the characters "w", "s", "S", are there any other letters from 'a'
to 'z' (or from 'A' to 'Z') that have a special meaning in
RegularExpressions? If yes, what are they?
Thanks,
Arpan
a valid e-mail address which has a '@' & ends with ".com":
<asp:TextBox id="txtEMail" runat="server"/>
<asp:RegularExpressionValidator ControlToValidate="txtEMail"
ValidationExpression="\w+\@\w+\.com" ErrorMessage="Invalid Email ID"
runat="server"/>
I have gone through many articles on RegularExpressions available on
the Net but have never come across the "w" RegularExpression character.
I know what the other RegularExpression characters used above do but
what is this "w"? What does "w" mean here"? Does it signify a word
(which can be just about anything)?
Similarly, consider the following RegularExpression:
href\\s*=\\s*(\"([^\"]*)\"|(\\S+))
The above RegularExpression means 'href' followed by zero or more white
spaces (\s*), then by '=', then by zero or more white spaces again.
This is then followed by a double quote (\"), then by zero or more
occurences of anything that's not a double quote ([^\"]*), followed by
a double quote 'or' one or more non-white space characters (\S+).
Like the characters "w", "s", "S", are there any other letters from 'a'
to 'z' (or from 'A' to 'Z') that have a special meaning in
RegularExpressions? If yes, what are they?
Thanks,
Arpan