Postgresql Index Of String Python Replace