Regular Expressions 101

Community Patterns

1...45678...902

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^(?<track>https:\/\/soundcloud.com\/(?:(?!sets|stats|groups|upload|you|mobile|stream|messages|discover|notifications|terms-of-use|people|pages|jobs|settings|logout|charts|imprint|popular)(?:[a-z0-9\-_]{1,25}))\/(?:(?:(?!sets|playlist|stats|settings|logout|notifications|you|messages)(?:[a-z0-9\-_]{1,100}))(?:\/s\-[a-zA-Z0-9\-_]{1,10})?))(?:[a-z0-9\-\?=\/]*)$
/
gm

Description

Capture only the URL for a Soundcloud track. All other options, pages, sets and variations are either ignored (if needed) or filtered.

Result; a clean Soundcloud track URL.

Submitted by anonymous - 5 years ago