What you are doing is almost correct.
But instead of regexp_like' you need to use
regexp_substr`:sp
select regexp_substr('lorem-ipsum-dolor-2','\d+$') from dual;
Question
I am trying to make unique slug URL in oracle using with regular expression. How can I get numeric value end of URL like that lorem-ipsum-dolor-2
. My purpose that; Before I check inserted title if exist on table, check it numeric value end of URL if exist slug URL, if has numeric value increase it and save. I have tried the following regular expression that worked properly in C# but it not work in Oracle.
select regexp_like('lorem-ipsum-dolor-2','(\d+)*$') from dual;
Solution
What you are doing is almost correct.
But instead of regexp_like' you need to use
regexp_substr`:sp
select regexp_substr('lorem-ipsum-dolor-2','\d+$') from dual;
OTHER TIPS
If you are using oracle APEX, and I can assume that's the case if you are working with URLs, than you can use
select apex_string_util.to_slug('Any, Text!;') from dual;
>> any-text