Regular Expressions 101

Sponsors

Library entries

1
javascript

Minecraft Log Parser 1.0

Improvements needed
Submitted by Crystal - 4 months ago
1
python

Parse Data Fields

Parsing example
Submitted by anonymous - 4 months ago
1
java

Rick Roll

Matches chorus of Never Going to Give You Up
Submitted by Stephen Battista - 4 months ago
1
python

ds100reg2

Data 100 Regular Expressions, adapted from Princeton
Submitted by anonymous - 4 months ago
1
python

Get domain name from URL

Get domain name from URL
Submitted by anonymous - 4 months ago
1
python

Extract time from text

Extract time from text
Submitted by anonymous - 4 months ago

North American Phone Number

Vote

4

Regular Expression
javascript

/
(?=(?:^(?:\+?1\s*(?:[.-]\s*)?)?(?!(?:(?:.*\(.*)|(?:.*\).*)))(?:[2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))|(?:.*\((?:[2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\).*))(?:\+?1\s*(?:[.-]\s*)?)?(?:\(?([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\)?)\s*(?:[.-]\s*)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d{1,15}))?$
/
gm

Description

Loading markdown...
Submitted by AaronBoots - 5 years ago