Hello everyone,
I am here to ask another regular expression question again here is my sample code:
select regexp_substr('6-3', '[0-9][/\-\.][0-9from dual;
result is null.
in square brackets, we write char list that can match. so I want to check if the punctuation char is a dot, hyphen or slash but if I changed their place:
select regexp_substr('6-3', '[0-9][/\.\-][0-9from dual;
result is 6-3
since backslash is escape char I am using it before hyphen but it seems it is treated as "range" operator anyway. is that correct?
also this is not just working when source string has hyphen, if I change it to dot, it is working on every pattern.
also when I use (\-|\.) is working again.
edit: while writing this question, I tried [\-/\.] and I got "invalid range" error. so hyphen in square brackets is always treated as range operator is this correct? of course except it is not at the end of the list, then there is no range and it is working.
thanks.