I need the first 5 characters after the last slash. I can handle to get all symbols after slash, but fail to take only the first 5 of them.
REGEX_SUBSTR('people/capital/base/flagedbyloggers','[^/]*$')
With [^/]*$
, I get flagedbyloggers
, but I need only flaged
, first 5 symbols.
With [^/]{5}$
, I get ggers
, which is 5 last symbols after the last slash, but I need flaged
, first 5 symbols after the last slash.
Also sometimes the string after last slash can be shorter, so it has to work with less then 5 characters, e.g. people/capital/base/no
should return only no
.
The environment is ORACLE database. Same result I have with online tool https://regexr.com/ .