Regular Expressions 101

Community Patterns

Validation - HTTP User Agent

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?!\s)(?:(?<![\d\w.\/])(?:(?:[\w\d,]+\/(?!\.)[\d\.]+\+?(?<!\.))|(?:\((?:[\d\w\s\.\/-](?:;\s)?)+\))|(?:))\s?)+(?<!\s)$
/
gm

Description

Validate only / non-capturing

Submitted by razor velvet - 2 months ago