regex - Oracle regexp_instr -


can 1 maybe me regular expression?

i wanted check if in given string ',' present or not.

literal: first_name+;last_name+john, smith

here wanted check if last_name contains ','

select case when regexp_instr('first_name+;last_name+john, smith;home_adress+michigan',                                        '^(.*?\;|\+)*last_name\+(.*\,).*$', ',') > 1   'ok' else 'nok' end test1 dual; 

the third argument regexp_instr() optional starting position - omit it.

also, since regexp matches entire string, doesn't make sense check regexp_instr() > 1 - if match, regexp_instr() return 1, otherwise 0.

with v_data (   select 'first_name+;last_name+john, smith;home_adress+michigan' name dual    union   select 'first_name+john;last_name+smith;home_adress+michigan' name dual  ) select    name,    regexp_instr(name, '^(.*?\;|\+)*last_name\+(.*\,).*$')  v_data 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -