Skip to content

Instantly share code, notes, and snippets.

@YiLi225
Created March 11, 2020 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YiLi225/f7a29ff515e115f5eb6138b3423d8971 to your computer and use it in GitHub Desktop.
Save YiLi225/f7a29ff515e115f5eb6138b3423d8971 to your computer and use it in GitHub Desktop.
-- Find and extract numbers between 0 - 9 that consecutively happens 5 times
SELECT
SUBSTRING(LONG_TEXT, REG_IDX, REG_IDX+5) AS NUMBER_LIST_FOUND
FROM
(
SELECT
REGEXP_INSTR(LONG_TEXT, '[0-9]{5}') AS REG_IDX,
LONG_TEXT
FROM
BONUS
) DAT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment