Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
12-10-2010, 07:02 AM #1
- Join Date
- Dec 2010
- Thanked 0 Times in 0 Posts
Regular Expressions provide a concise and flexible means for matching strings of text, such as particular characters, words, or patterns of characters. Regular expressions are used by many text editors, utilities, and programming languages to search and manipulate text based on patterns.
Some of the symbols used in regular expressions are as follows;
1) Vertical Bar (|) – This symbol is used to separate alternatives. Eg: rear|read can match both 'rear' and 'read'.
2) Parenthesis (()) – Defines the scope and precedence of operators. Eg: rea(r|d) can match both 'rear' and 'read'.
3) Quantification Tokens – There are a list of quantification tokens. Like:
a) ? – This denotes that there may be one or zero instance of the symbol present. Eg: rea?d can match both 'read' and 'red'
b) * – This denotes that there may be zero or more instance of the symbol present. Eg: rea*d can match all 'read','red','reaaad','reaad' etc.
c) + – This denotes that there may be one or more instance of the symbol present. Eg: rea+d can match all 'read','reaaaad','reaaad','reaad' etc
These expression are of great use when we are checking for a particular pattern through our program in .Net/Javacript. Like it may be useful in checking for any presence of special characters in a username field. It may also come to use when we are validating a mobile number field against the entry of any alphanumeric value. If we know how to use this feature properly, then the time taken for validating several fields may reduce by ½
1) Validate against any blank values:
2) Validate against non – words:
3) Validate against any blank values:
4) Trimming a string – Removing its left and right blank spaces:
5) Validating an Email Address:
6) Validating a File Name:
To go through a thorough tutorial on this topic along with a Video Tutorial to undesrtand in a better way, please visit;
12-10-2010, 03:47 PM #2
- Join Date
- Jun 2002
- London, England
- Thanked 2,585 Times in 2,563 Posts
Far better tutorials are already on this site at
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems." — Jamie Zawinski.