So I have a column (called account_uri) in a postgres table that looks like this:
/randomCharacters/123456/randomNumbers
I need to query for the substring in the middle, which is a string of characters between two / symbols.
My current attempt looked like this:
SELECT
REVERSE(SUBSTRING(REVERSE([account_uri]),0,CHARINDEX('/',REVERSE(account_uri))))
FROM exp_logs
LIMIT 15
Which selects only the randomNumbers and not the desired numbers.
I tried to build on that idea though and used
(SUBSTRING(REVERSE(SUBSTRING(REVERSE([account_uri]),CHARINDEX('/',REVERSE(account_uri)))),1,CHARINDEX('/',REVERSE(SUBSTRING(REVERSE([account_uri]),CHARINDEX('/',REVERSE(account_uri)))))))
but that only returns a bunch of / symbols and no numbers at all.
If anyone can help me query for this substring, I would be immensely grateful
postgresql? cause there is nocharindex()function per postgres documentation (postgresql.org/docs/current/static/functions-string.html)