Regular Expressions 101

Community Patterns

Designed to extract field type and its size, if available, from the definition of the columns in a SQLite query.

0

Regular Expression
PCRE (PHP <7.3)

/
(?:(?:(?<Name>[[:alpha:]]+)[ ]*\(['"]?(?<Value>[^)'"]*)['"]?\))|(?:(?<Null>(?:NOT NULL|NULL))))
/
gis

Description

i.e :

input:
"NUMERIC(5,2) NOT NULL DEFAULT ('100.00')" extract : Name = [ 1 => "Numeric", 2 => "Default" ] Value = [ 1 => "5,2", 2 => "100.00" ] Null = [ 1 => "NOT NULL" ]

Submitted by anonymous - 8 years ago