Regular Expressions 101

Community Patterns

0

ipv4

PCRE2 (PHP >=7.3)
Find ipv4 addresses
Submitted by anon - a year ago
0

test

PCRE2 (PHP >=7.3)
test
Submitted by test - a year ago
0

regex_commercial_activities

PCRE2 (PHP >=7.3)
guifro
Submitted by guifro - a year ago

my apache2 access.log regex

1

Regular Expression
PCRE (PHP <7.3)

/
(?<src_host>\w+\.\w+:\d{2})\s(?<src_ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\D{1,6}(?<date_time>[^ ]+)\s(?<GMT_offset>[^ ]+)\]\s"(?<action>(GET|POST|HEAD|TRACE|PUT|DELETE|CONNECT))\s(?<hash_url>[^ ]+)\s(?<protocol>[^\"]+)\"\s(?<code>\d{1,3})\s(?<size>[^ ]+)\s\"(?<referrer>[^ ]+)\"\s\"(?<user_agent>[^ ]+.+)\"
/
g

Description

Loading markdown...
Submitted by marf - 8 years ago