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;
Was it helpful?

Solution

What you are doing is almost correct.

But instead of regexp_like' you need to useregexp_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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top