Regular Expressions 101

Community Patterns

Match T-SQL view definition

1

Regular Expression
PCRE2 (PHP >=7.3)

/
USE\s(?P<db>\[\w+\]);?\s* CREATE VIEW (?P<schema>\[\w+\])\.(?P<name>\[\w+\]) AS\s* (?P<sql>.+)
/
gis

Description

This regex matches the Transact SQL statement for selecting the database and creating a view.

Submitted by anonymous - 6 months ago