reg expression

P

Pat

i want to validate "123456789P"
what Val expression should i use..
I want to validate a Validate a sim serial number
Any ideas
 
P

Pat

What i really want to validate is 123456789P
But the last letter has to be P or N
Any ideas..
 
H

Hans Kesting

Pat said:
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
 
H

Hans Kesting

naijacoder said:
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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top