REGEXP_INSTR [message #665156] |
Wed, 23 August 2017 09:36 |
pstanand
Messages: 133 Registered: February 2005 Location: Chennai,India
|
Senior Member |
|
|
Hi,
Thanks for your guidance and support.
I have a requirement to find the string that has an alphabet in 1,2 and 8th position and number in 3 and 7 position.
I used regexp_instr(testval,'[A-Za-z]',2)=2. It gives the required value.
Is there any way to find all this in one statement.
The same requirement is required for opposite way.
Request your suggestion and help.
Thanks.
create table testchar(testval varchar2(8));
insert into testchar values('A2345678');
insert into testchar values('1B345678');
insert into testchar values('1234567H');
insert into testchar values('12345678');
insert into testchar values('!@3$%^()');
insert into testchar values('!@#$%^7*');
|
|
|
|
Re: REGEXP_INSTR [message #665168 is a reply to message #665163] |
Thu, 24 August 2017 02:04 |
pstanand
Messages: 133 Registered: February 2005 Location: Chennai,India
|
Senior Member |
|
|
Many thanks Mike.
To get the opposite way that's other than 1,2 and 8 postion if it is number and 3 and 7th position if it is char, shall I use
case when not regexp_like(testval,'^:alpha:{2}\d...\d:alpha:') then 'OK' else 'ko' end flag.
Will it resolve? Your suggestion is highly appreciated.
Thanks.
|
|
|
|
Re: REGEXP_INSTR [message #665252 is a reply to message #665188] |
Mon, 28 August 2017 02:10 |
pstanand
Messages: 133 Registered: February 2005 Location: Chennai,India
|
Senior Member |
|
|
Hi Mike,
My question is . If I don't have char at the 1,2 and 8 positions, also no numeric values at 3 and 7th position, shall I use the NOT operator to get this done?
LIke: '12MICHE8'
Your solution provides me to get the string which is having char at 1,2,8 and numeric at 3 and 7 position which is fine.
Thanks.
|
|
|
|
|
|
|