Regular Expressions 101

Community Library Entry

2

Regular Expression
PCRE (PHP <7.3)

/
^(http\:\/\/|https\:\/\/)?(?:www\.)?twitter\.com\/(?:#!\/)?@?([^\?#]*)(?:[?#].*)?$
/
i

Description

Pattern that check your string to match Twitter user profile URL.

Submitted by JSC Quatrodev - 9 years ago