Find the position of a substring in postgres
Postgres has a strpos
function for finding the position of a substring in a given string:
select strpos('wibble', 'ibb');
The function returns an integer representing the location of the substring in the provided string, or a 0
if the substring cannot be found in the provided string (the locations are 1-based indexes, so you don't have to worry about collisions!).