I am working on Oracle 10gR2.
I am working on a column which stores username. Let’s say that one of the values in this column is “Ankur”. I want to fetch all records where username is a concatenated string of “Ankur” followed by some numerical digits, like “Ankur1”, “Ankur2”, “Ankur345” and so on. I do not want to get records with values such as “Ankurab1” – that is anything which is concatenation of some characters to my input string.
I tried to use REGEX functions to achieve the desired result, but am not able to.
I was trying:
SELECT 1 FROM dual WHERE regexp_like ('Ankur123', '^Ankur[:digit:]$');
Can anyone help me here?
Oracle uses POSIX EREs (which don’t support the common
\dshorthand), so you can useYour version would nearly have worked, too:
One set of
[...]for the character class, and one for the[:digit:]subset. And of course a+to allow more than just one digit.