Marketing Analytics in Google Sheets
Luke Pajer
Digital Marketing Specialist
R users
and Python Users
?Breaking down the regular expression that will match all campaigns ending in users:
regular_expression = .*[u|U]sers
.*
- matches any number of characters preceding the word 'users'u|U
- matches either the lower or upper case variation of letter 'u'[u|U]sers
- matched terms must contain one of the items within the bracketsThree regular expression metacharacter categories: Wildcards, Anchors, and Groups.
Wildcards:
.
matches any character*
matches 0 or more times?
matches 0 or 1 time+
matches 1 or more timesx|y
matches x OR y\
escapes any special characterExamples:
d.g
matches both 'dog' and 'dig'.*
matches all the letters in 'dog'dogs?
matches either 'dog' or 'dogs'dog.+
matches 'dogs' but not 'dog'dog|cat
matches either 'dog' or 'cat'who\?
matches 'who?'Anchors
^x
the start of a stringx$
the end of a stringExamples
^T
matches 'The dog likes to dig'g$
matches 'The dog likes to dig'Groups
[x|X]
matches either 'x' or 'X'{x}
matches x
number of timesExamples
[d|D]og
matches either 'dog' or 'Dog'.{2}
matches 'Do' in 'Dog'Marketing Analytics in Google Sheets