• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

Regular Expressions (Regex) - Comprehensive Guide

Overview

Regular Expressions, commonly abbreviated as Regex, are sequences of characters that define a search pattern. They are used extensively in programming, data validation, search operations, and text processing.

Syntax and Patterns

Basic Elements Character Classes

Symbol​
Description​
.​
Matches any character except a newline​
^​
Anchors the match at the beginning of a string​
$​
Anchors the match at the end of a string​
*​
Matches 0 or more repetitions​
+​
Matches 1 or more repetitions​
?​
Matches 0 or 1 occurrence​
[]​
Matches any one character within the brackets​
[^]​
Matches any character not in the brackets​
{n}​
Matches exactly n occurrences​
{n,}​
Matches at least n occurrences​
{n,m}​
Matches between n and m occurrences

Character Classes

Class​
Matches​
\d​
Any digit (0-9)​
\D​
Any non-digit​
\w​
Any word character (alphanumeric + underscore)​
\W​
Any non-word character​
\s​
Any whitespace character​
\S​
Any non-whitespace character​

Common Examples

1. Email Validation​

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-z]{2,}$

Matches: [email protected], [email protected]

2. Extract Numbers​

\d+

Matches: Any sequence of digits like 123, 45678

3. Indian Mobile Number Validation​

^[6-9]\d{9}$

Matches: 9876543210, 9123456789

4. PAN Number (India) Validation​

^[A-Z]{5}[0-9]{4}[A-Z]{1}$

Matches: ABCDE1234F

5. Date in dd-mm-yyyy or dd/mm/yyyy Format​

^(0[1-9]|[12][0-9]|3[01])[-/](0[1-9]|1[0-2])[-/](19|20)\d{2}$

Matches: 21-04-2025, 01/01/2000

6. Detect Purchase Intent Keywords​

\b(interested|purchase|buy)\b

Matches: Any standalone occurrence of "interested", "purchase", or "buy" (e.g., "I am interested", "ready to purchase", "want to buy")


Online Regex Testing Tools


To fully unlock the power of regex, it's encouraged to explore more through hands-on practice and self-research. Many complex patterns and use cases can be discovered by experimenting and searching specific scenarios online.
 

Similar threads

P
Replies
0
Views
4K
PabblyMember3
P
Top