Regular Expressions 101

Community Patterns

Twitter user profile url pattern

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