473,396 Members | 1,768 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

reg expression

Pat
i want to validate "123456789P"
what Val expression should i use..
I want to validate a Validate a sim serial number
Any ideas
Nov 19 '05 #1
5 1035
Pat
What i really want to validate is 123456789P
But the last letter has to be P or N
Any ideas..

"Pat" <na********@hotmail.com> wrote in message
news:e1**************@TK2MSFTNGP10.phx.gbl...
i want to validate "123456789P"
what Val expression should i use..
I want to validate a Validate a sim serial number
Any ideas

Nov 19 '05 #2
Pat wrote:
i want to validate "123456789P"
what Val expression should i use..
I want to validate a Validate a sim serial number
Any ideas


You give just an example, not the rules for a "correct format",
but I take it that you mean: 9 digits followed by either "P" or "N"
(seeing your followup post).

the RE is: [0-9]{9}[NP]

[0-9] chars from 0 to 9
{9} the previous repeated exactly 9 times
[NP] either a capital N or a capital P
Hans Kesting
Nov 19 '05 #3
Thx Hans for the reply
I tried testing [0-9]{9}[NP] at :-
http://www.regexlib.com/RETester.aspx
But it seem not to work..
i tried 123456789P and 123456789N
but didn't match
About if i want both capital and small letters p and n
to match
Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #4
naijacoder naijacoder wrote:
Thx Hans for the reply
I tried testing [0-9]{9}[NP] at :-
http://www.regexlib.com/RETester.aspx
But it seem not to work..
i tried 123456789P and 123456789N
but didn't match
About if i want both capital and small letters p and n
to match
Thanks

*** Sent via Developersdex http://www.developersdex.com ***


I tried there and it *did* match:
- ignore the "external data source" fields
- enter the text (123456789N) in the first textarea
- enter the RE ([0-9]{9}[NP]) in the second textarea (below the title "regular expression")
- hit the "execute" button
- the "matches" table below shows it matched entirely

for both capitals and small letters, change [NP] to [NnPp]

Hans Kesting
Nov 19 '05 #5
Thx Hans its matching ok
Thx

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Paul Rubin | last post by:
OK, I want to scan a file for lines matching a certain regexp. I'd like to use an assignment expression, like for line in file: if (g := re.match(pat, line)): croggle(g.group(1)) Since...
70
by: Roy Yao | last post by:
Does it mean "(sizeof(int))* (p)" or "sizeof( (int)(*p) )" ? According to my analysis, operator sizeof, (type) and * have the same precedence, and they combine from right to left. Then this...
22
by: Tony Johansson | last post by:
Hello Experts! I'm reading i a book about C++ and they mention infix with telling what it is. I hope you out there can do so. Many thanks! //Tony
2
by: Mike Turco | last post by:
I like using the expression builder for a lot of different things but it isn't always available when I want to use it, for example in the code window, or in all of the control properties. I am...
14
by: John Temples | last post by:
Given this code: extern volatile unsigned char v; int main(void) { v; return 0; }
15
by: Nerox | last post by:
Hi, If i write: #include <stdio.h> int foo(int); int main(void){ int a = 3; foo(a); }
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
1
by: lovecreatesbea... | last post by:
---quoting--- Annex C (informative) Sequence points 1 The following are the sequence points described in 5.1.2.3: - The end of a full expression: an initializer (6.7.8); the expression in an...
28
by: Marc Gravell | last post by:
In Linq, you can apparently get a meaningful body from and expression's .ToString(); random question - does anybody know if linq also includes a parser? It just seemed it might be a handy way to...
18
by: dspfun | last post by:
Hi! The words "expression" and "statement" are often used in C99 and C- textbooks, however, I am not sure of the clear defintion of these words with respect to C. Can somebody provide a sharp...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.