Regular Expressions 101

Community Patterns

Tiktok video regex

0

Regular Expression
Python

r'''
(?:http(?:s)?:\/\/)?(?:(?:www)\.(?:tiktok\.com)(?:\/)(?!foryou)(@[a-zA-z0-9]+)(?:\/)(?:video)(?:\/)([\d]+)|(?:m)\.(?:tiktok\.com)(?:\/)(?!foryou)(?:v)(?:\/)?(?=([\d]+)\.html))
'''
gm

Description

Extract the id only from the necessary and supported links oembed tool provided by tiktok to embed these videos

Submitted by Oscar David Garces Gomez - FB@soyvillareal - 2 years ago