Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^\s*insert(?:\s+into)?\s+(?<TableName>\[.*?\]|[^ (]+)\s*\((?<Columns>.+?)\)
/
gim

Description

Parses a very basic SQL INSERT statement of the form:

INSERT [INTO] <table_name> (<fields>) VALUES (<values>)

Submitted by anonymous - 7 years ago