I have a string of this type:
URL/X/help?
X stands for chars like: a,b,c etc... Only one chars in that place.
The length of URL is unknown it can be: www.website.com , www.website.co.uk , www.website.info etc...
I want to find out the position of /X/ in the string but only if X is: s,b,t
/X/ - appear once and only once in the string.
Something like:
select position ('/s/' or '/b/' or '/t/' in URL)
however this is not PostgreSQL syntax.
Is there a way to write this query except doing :
select position ('/s/' in URL) +
select position ('/b/' in URL) +
select position ('/t/' in URL)
EDIT:
There are no complex cases. No need to worry about /s/s or /b//s/ or /s/g/ or /s/..../s/ etc... Just the simple case I presented. It also guaranteed that /CHAR/ will appear exactly once but the char is unknown.