Tutorialsteacher

Follow Us

Articles
  • C#
  • C# OOP
  • ASP.NET Core
  • ASP.NET MVC
  • LINQ
  • Inversion of Control (IoC)
  • Web API
  • JavaScript
  • TypeScript
  • jQuery
  • Angular 11
  • Node.js
  • D3.js
  • Sass
  • Python
  • Go lang
  • HTTPS (SSL)
  • Regex
  • SQL
  • SQL Server
  • PostgreSQL
  • MongoDB
  • Regex - Get Started
  • Regex Syntax
  • Characters
  • Metacharacters
  • Quantifiers
  • Character Classes
  • Grouping
  • Lookarounds
  • Substitution
Entity Framework Extensions - Boost EF Core 9
  Bulk Insert
  Bulk Delete
  Bulk Update
  Bulk Merge

Frequently Used Regex Patterns

Regex expressions are used frequently in searching or validating different formats. The followings are frequently used regex patterns.

Email Validation Pattern

Regex pattern ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,}$ matches a valid email address.

//g
0

URL Validation Pattern

Regex pattern ^(https?://)?([a-z0-9]+([-.]{1}[a-z0-9]+)*.[a-z]{2,5})(:[0-9]{1,5})?(/.*)?$ matches a valid URL starting with http or https.

//g
0

Numeric Input Validation Pattern

Regex pattern ^d+(?:.d+)?$ validates numeric input, including both decimal and integer values.

//g
0

Date Validation Pattern (YYYY-MM-DD)

Regex pattern ^(?:19|20)dd-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$ matches a valid date in YYYY-MM-DD format.

//g
0

Time Validation Pattern (HH:MM AM/PM)

Regex pattern ^(1[0-2]|0?[1-9]):[0-5][0-9] (AM|PM)$ matches a time in 12-hour format with optional AM/PM designation.

//g
0

Phone Number Validation Pattern

Regex pattern ^+?[1-9]d{1,14}$ validates a phone number, allowing an optional "+" sign at the beginning.

//g
0

Zip Code Validation Pattern (US)

Regex pattern ^d{5}(?:[-s]d{4})?$ matches a US ZIP code, with or without the optional ZIP+4 format.

//g
0

Password Strength Validation Pattern

Regex pattern ^(?=.*[A-Z])(?=.*[a-z])(?=.*d)(?=.*[^ws]).{8,}$ validates a password with the following criteria: at least one uppercase letter, one lowercase letter, one digit, one special character, and a minimum length of 8 characters.

//g
0

File Extension Validation Pattern

Regex pattern ^.+\.(jpg|jpeg|png|gif|pdf)$ matches common image and document file extensions (jpg, jpeg, png, gif, pdf).

//g
0

IP Address Validation Pattern

Regex pattern ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.)3(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ matches a valid IPv4 address in xxx.xxx.xxx.xxx format that includes four groups of numbers separated by dots and each group can range from 0 to 255.

//g
0
TUTORIALSTEACHER.COM

TutorialsTeacher.com is your authoritative source for comprehensive technologies tutorials, tailored to guide you through mastering various web and other technologies through a step-by-step approach.

Our content helps you to learn technologies easily and quickly for learners of all levels. By accessing this platform, you acknowledge that you have reviewed and consented to abide by our Terms of Use and Privacy Policy, designed to safeguard your experience and privacy rights.

[email protected]

ABOUT USTERMS OF USEPRIVACY POLICY
copywrite-symbol

2024 TutorialsTeacher.com. (v 1.2) All Rights Reserved.