Hello,
I have a REGEX validator which checks for DIGITS ONLY, 10 or 11 digits in
length. The pattern is:#
^\d{10,11}$
I would like to enhance this pattern so in addition to only digits, and
string must be 10 or 11 characters in length, - I would like the first
character to be a 0, and the second character must NEVER be a 0.
Matches:
0100000000
01234567890
0101010101
Non Matches:
1000000000
0010000000
1010101010
Any regex pro's here able to assist?
Kind Regards,
Gary. 2 1140
On Mar 1, 4:29 pm, "G" <g...@nospam.comwrote:
Hello,
I have a REGEX validator which checks for DIGITS ONLY, 10 or 11 digits in
length. The pattern is:#
^\d{10,11}$
I would like to enhance this pattern so in addition to only digits, and
string must be 10 or 11 characters in length, - I would like the first
character to be a 0, and the second character must NEVER be a 0.
Matches:
0100000000
01234567890
0101010101
Non Matches:
1000000000
0010000000
1010101010
Any regex pro's here able to assist?
Kind Regards,
Gary.
^0(?!0)\d{8,9}$
Alexey Smirnov wrote:
On Mar 1, 4:29 pm, "G" <g...@nospam.comwrote:
>Hello,
I have a REGEX validator which checks for DIGITS ONLY, 10 or 11 digits in length. The pattern is:#
^\d{10,11}$
I would like to enhance this pattern so in addition to only digits, and string must be 10 or 11 characters in length, - I would like the first character to be a 0, and the second character must NEVER be a 0.
Matches: 0100000000 01234567890 0101010101
Non Matches: 1000000000 0010000000 1010101010
Any regex pro's here able to assist?
Kind Regards,
Gary.
^0(?!0)\d{8,9}$
That would be:
^0(?!0)\d{9,10}$
as the look-ahead doesn't consume the character. :)
Here's another way of writing it, perhaps a bit more straight forward:
^0[1-9]\d{8,9}$
--
Göran Andersson
_____ http://www.guffa.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dave |
last post by:
I'm struggling with something that should be fairly simple. I just don't
know the regext syntax very well, unfortunately.
I'd like to parse words out of what is basically a boolean search...
|
by: jeevankodali |
last post by:
Hi
I have an .Net application which processes thousands of Xml nodes each
day and for each node I am using around 30-40 Regex matches to see if
they satisfy some conditions are not. These Regex...
|
by: clintonG |
last post by:
I'm using an .aspx tool I found at but as nice as the interface is I
think I need to consider using others. Some can generate C# I understand.
Your preferences please...
<%= Clinton Gallagher
...
|
by: Mike Labosh |
last post by:
I have the following System.Text.RegularExpressions.Regex that is supposed
to remove this predefined list of garbage characters from contact names that
come in on import files :
Dim...
|
by: jmchadha |
last post by:
I have got the following html:
"something in html ... etc.. city1... etc... <a class="font1"
href="city1.html" onclick="etc."click for <b>info</bon city1 </a>
... some html. city1.. can repeat...
|
by: Chris |
last post by:
Hi Everyone,
I am using a regex to check for a string. When all the file contains is my
test string the regex returns a match, but when I embed the test string in
the middle of a text file a...
|
by: Extremest |
last post by:
I am using this regex.
static Regex paranthesis = new Regex("(\\d*/\\d*)",
RegexOptions.IgnoreCase);
it should find everything between parenthesis that have some numbers
onyl then a forward...
|
by: Phil Barber |
last post by:
I am using Regex to validate a file name. I have everything I need except I
would like the dot(.) in the filename only to appear once. My question is it
possible to allow one instance of character...
|
by: jonnyboy6969 |
last post by:
Hi All
Really hoping someone can help me out here with my deficient regex skills :)
I have a function which takes a string of HTML and replaces a term (word or phrase) with a link. The pupose...
|
by: Support Desk |
last post by:
That’s it exactly..thx
-----Original Message-----
From: Reedick, Andrew
Sent: Tuesday, June 03, 2008 9:26 AM
To: Support Desk
Subject: RE: regex help
The regex will now skip anything with...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |