KEMBAR78
Regular Expression | PDF | Notation | Computer Programming
0% found this document useful (0 votes)
9 views1 page

Regular Expression

The document provides a comprehensive overview of regular expression syntax and its components, including character matching, grouping, and quantifiers. It includes examples for various expressions such as gender representation, phone numbers, street addresses, city names, email addresses, and credit card numbers. Each expression is explained with its corresponding description to illustrate its usage.

Uploaded by

vijaya2511
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Regular Expression

The document provides a comprehensive overview of regular expression syntax and its components, including character matching, grouping, and quantifiers. It includes examples for various expressions such as gender representation, phone numbers, street addresses, city names, email addresses, and credit card numbers. Each expression is explained with its corresponding description to illustrate its usage.

Uploaded by

vijaya2511
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Expression Description

. Indicates any character.


Indicates that the character that follows should be interpreted literally, instead of
\
as a special character. For example, \. indicates a literal '.'.
() Groups the operators that are inside the parentheses.
{n} Generates n instances of the previous item. For example, a{2} generates 'aa'.
Generates at least n instances but no more than m instances of the previous item.
{n,m}
For example, a{2,4} generates 'aa', 'aaa', or 'aaaa'.
Generates n or more instances of the previous item. For example, a{2,} generates
{n,}
'aa', 'aaa', 'aaaa', 'aaaaa', and so forth.
* Generates 0 or more instances of the previous item.
+ Generates 1 or more instances of the previous item.
? Generates 0 or 1 instance of the previous item.
| Generates an item on either side of the | character.
[aeiou] Generates any character inside the brackets.
[a-z] Generates any character in the specified range of characters.
[^aeiou] Generates any character except those inside the brackets.
Example

Expression Description
A simple
(F|M) representation of
gender.
A simple phone
[1-9][0-9]{2,2}-[1-9][0-9]{2,2}-[0-9]{4,4} number, represented
as 800-555-8446
International notation
\+1 (425|206)-[1-9][0-9]{2,2}-[0-9]{4,4} for a Seattle-area
phone number.
Zip code plus four
[1-9][0-9]{4}-[0-9]{4}
(such as 98008-2405)
[1-6]{1}[0-9]{1,3} (SE|NE|NW|SW) [1-2]{1}[0-9]{1,2}th (ST|CT|PL|
AVE), (Redmond, WA 9805[0-9]|Bellevue, WA 9800[1-9]| A simple street
Sammamish, WA 9807[0-9]|Seattle, WA 9806[0-9]|Issaquah, WA address.
9808[0-9])
Seattle|(New York)|Boston|Miami|Beijing|(Los Angles)|London|Paris A list of city names.
A simple e-mail
[a-z]{5,8}@(hotmail\.com|msn\.com|[a-z]{3,8}\.(com|net|org))
address.
[1-9][0-9]{3} [0-9]{4} [0-9]{4} [0-9]{4} Credit-card number.

You might also like