Regular Expressions 101

Community Patterns

Url with <a> (param) validation

2

Regular Expression
PCRE (PHP <7.3)

/
^((http|https):\/\/)?(www[0-9]\.)?(([A-Za-z0-9_-])+\.{1})+([A-Za-z]{2,4}|\<[^<>]+\>)(\/([A-Za-z0-9_-])+)*(\/)?$
/
mg

Description

https://www.google.com http://www.google.net/hello https://www.google.<var> http://www.google.<hello>/hello

above url matching with given regex

Submitted by Duleep Dissanayaka - 10 years ago