Skip to content

3415. Find Products with Three Consecutive Digits

1
2
3
4
5
6
7
SELECT product_id, name
FROM Products
WHERE
  name REGEXP '[^0-9][0-9]{3}[^0-9]'
  OR name REGEXP '^[0-9]{3}[^0-9]'
  OR name REGEXP '[^0-9][0-9]{3}$'
ORDER BY 1;