Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(((iPhone([\d\W]+)|iPhone|iPad)(;|\s\d+;|\s\w+;|\s\d+\w+;)?(\s+)?(U;)?)(\s+)?(CPU|iOS)([^\);]+)?)
/
gm

Description

Regex matches iPhone, iPad, iPod user agents. Tested against 250k apache log lines.

By Dennis Faas https://www.infopackets.com

Submitted by anonymous - 2 years ago