oracle11g - Oracle regular expression using hyphen in pattern -
why query returning value 4 (i expected 0)?
select regexp_instr ('123abc','[a-z]') dual;
i think []
should indicate character list, , a-z includes upper letters?
this affected session's nls_sort setting, , result of 4 if have case-insensitive sorting enabled:
alter session set nls_sort=binary; select regexp_instr ('123abc','[a-z]') dual; regexp_instr('123abc','[a-z]') ------------------------------ 0 alter session set nls_sort=binary_ci; select regexp_instr ('123abc','[a-z]') dual; regexp_instr('123abc','[a-z]') ------------------------------ 4
you can read more in documentation; , may find this answer useful too.
Comments
Post a Comment