← Journal

Snippets

Regex patterns I keep reaching for.

By Ibukun Adeyemi · 1 min read

Use this pattern to extract only the course ID from meta keys like course_123_access_from:

(?<=course_)[0-9]+(?=_access_from)

Use this one in SQL to pull out the first number found inside a string:

REGEXP_SUBSTR(%1$s, '[0-9]+')

Got a thought on this?

Share it with us