Don't replace the single quotes in pattern as we're using raw SQL.