Matching Email Addresses:
(?:[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})
john.doe@example.com
and jane@example.org
Extracting URLs from Text:
(?:http|https)://[^\s]+
https://www.example.com
and http://example.org
Parsing CSV Data:
(\w+),(\w+),(\d+)
John,Doe,30
and Jane,Smith,25
. Captures "John", "Doe", and "30" in group 1, 2, and 3 respectively for the first match, and "Jane", "Smith", and "25" for the second match.Extracting Hash Tags from Social Media Posts:
#\w+
#launch
and #excited
Extracting HTML Tags from Text:
<[^>]+>
<p>
, <b>
, </b>
, and </p>
Validating IPv4 Addresses:
\b(?:\d{1,3}\.){3}\d{1,3}\b
192.168.1.1
Matching Markdown Links:
\[(.*?)\]\((.*?)\)
[our website](https://www.example.com)
. Captures "our website" and "https://www.example.com" in group 1 and 2 respectively.Identifying Twitter Usernames:
@([A-Za-z0-9_]+)
@john_doe
and @jane_smith
. Captures "john_doe" and "jane_smith" in group 1.Matching Scientific Notation:
\b\d+(\.\d+)?[eE][+-]?\d+\b
3.00e8
Extracting YouTube Video IDs from URLs:
(?:youtu\.be/|youtube\.com(?:/embed/|/v/|/watch\?v=|/watch\?.+&v=))([^"&?/]+)
dQw4w9WgXcQ
Extracting Dates from Text:
\b\d{2}/\d{2}/\d{4}\b
02/14/2024
Identifying GitHub Repository Names:
github\.com\/(\S+)\/(\S+)
user
and repo
Parsing Markdown Headings:
^#{1,6}\s(.+)$
Introduction
, Subheading
, and Sub-subheading
Extracting Currency Values:
\$\d+(\.\d{2})?
$10.99
Identifying Twitter Hashtags and Mentions:
[@#][^\s#@]+
#DataScience
and @DataScientist
Matching HTML Attributes:
<a href="https://www.example.com">Click here</a>
([a-zA-Z-]+)="([^"]+)"
href="https://www.example.com"
. Captures href
and https://www.example.com
in group 1 and 2 respectively.Extracting File Extensions:
\.([a-zA-Z0-9]+)$
.pdf
Matching JavaScript Function Calls:
\w+\(([^)]*)\)
myFunction(arg1, arg2)
. Captures arg1, arg2
in group 1.Identifying Roman Numerals:
\b[IVXLCDM]+\b
IX
Extracting HTML Comments:
<!-- This is a comment -->
<!--(.*?)-->
<!-- This is a comment -->
. Captures This is a comment
in group 1.