Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
\s*(\w+)\s*:\s*(\w+)\s*
/
gm

Description

Extract the options from a rule in the js_htparser framework

{{ request: key option1:value1 option2:value2 }}

When executing the regex the matches will be: group1 = option key ( 1. iteration: option1, 2. iteration: option2 ) group2 = option value ( 1. iteration: value1, 2. iteration: value2 )

Submitted by Alexander Bassov - 6 years ago