|
|
|
|
|
|
|
|
|
|
Re: Validation of PAN Number in sql query [message #586335 is a reply to message #586289] |
Wed, 05 June 2013 05:39 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
dariyoosh wrote on Wed, 05 June 2013 13:51
So instead of [A-Z] you may want to use [a-zA-Z] (unless the requirement was only capital letters).
You can always use ignore case(i), instead of mentioning as [a-zA-Z]
|
|
|
|
|
|
|
|
Re: Validation of PAN Number in sql query [message #678706 is a reply to message #678674] |
Mon, 30 December 2019 06:44 |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
And another variation
SELECT pan
FROM pan_number
WHERE REGEXP_LIKE(pan, '^[A-Z]{5}.{4}[A-Z]{1}$');
using this regular expression the following strings are valid
ABCDE1234A
FGHIG5678F
and the following strings arew invalid
ABCDE12345
ABCD1234A
If the positions from 6-9 need to be a number you can use
SELECT pan
FROM pan_number
WHERE REGEXP_LIKE(pan, '^[A-Z]{5}[0-9]{4}[A-Z]{1}$');
[Updated on: Mon, 30 December 2019 06:48] Report message to a moderator
|
|
|