Regular Expressions 101

Community Patterns

Fing GTM code in html

1

Regular Expression
PCRE2 (PHP >=7.3)

/
GTM-[A-Z0-9]+
/

Description

This function extracts the Google Tag Manager (GTM) key from a given input string. The GTM key typically follows the format "GTM-XXXXXX", where "XXXXXX" represents a unique identifier.

Submitted by kanapka94 - 18 days ago