Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
([a-zA-Z0-9-_\.~]*):\/\/((([a-zA-Z0-9-_\.~]*):?([a-zA-Z0-9-_\.~]*)?)\@?([a-zA-Z0-9-_\.~]*)(((?:\/[a-zA-Z0-9-_\.~]+)*\/?)\??((?:[a-zA-Z0-9-_\.~=]+&?)+)?\#?([a-zA-Z0-9-_\.~]+)?))
/
gm

Description

a universal URL regex with different groups for different parameters

Submitted by anonymous - 6 years ago