Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

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

Description

This is a regex for a C-style variable capture. Group 1 is the type, group 2 is the name, group 3 is the operator, and finally, group 4 is the value.

Submitted by ThatSoulyGuy - 5 months ago