Regular Expressions 101

Community Patterns

123...6

Community Library Entry

40

Regular Expression
PCRE (PHP <7.3)

/
((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[.\!\/\\w]*))?)
/
ig

Description

A quite neat regular expression for URLs, e-mails..., I found on Matthew O'Riordan's blog.

Submitted by Matthew O'Riordan - 12 years ago