Click here to Skip to main content
14,924,621 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to write a regular expression which will accept 11 digit strat from 07 (LIKE 07123456789) or can accept NONE, and I am storing this regex in my DB 

What I have tried:

Updated 12-May-18 0:26am
GKP1992 11-May-18 8:09am
What is the problem with the one you came up with? The only thing I see is that your regex can accept "None" irrespective of the case of the letters. If you want only "NONE" specify it literally.


If you want to use regular expressions, get a copy of Expresso[^] - it's free, and it examines and generates Regexes.
What is the problem with this RegEx ?
The RegEx is matching 'none' and '07345678901'
Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre -[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
RegExr: Learn, Build, & Test RegEx[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
Plz Use

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900