Regular Expressions Sheet

ADVERTISEMENT

Regular Expressions
Regular Expressions
Use Regular Expressions to refine searches in the Google
Use Regular Expressions to refine searches in the Google
Analytics interface, or for Segments,
Analytics interface, or for Segments,
View Filters, or Content Groupings.
View Filters, or Content Groupings.
Wildcards
Wildcards
Char.
Description
Char.
Description
Matches any single character
Matches any single character
.
(letter, number or symbol)
.
(letter, number or symbol)
Example: goo.gle
Example: goo.gle
Matches zero or more of the previous item. The
Matches zero or more of the previous item. The
*
default previous item is the previous character
*
default previous item is the previous character
Example: goo*gle
Example: goo*gle
Just like a star, except that it must match at
Just like a star, except that it must match at
+
least one previous item
+
least one previous item
Example: goo+gle
Example: goo+gle
Matches zero or one of the previous item
Matches zero or one of the previous item
?
?
Example: labou?r
Example: labou?r
Allows you to do an "or" match
Allows you to do an "or" match
|
|
Example: a|b
Example: a|b
Anchors
Anchors
Data must be at beginning of its field
Data must be at beginning of its field
^
^
Example: ^blog
Example: ^blog
Data must be at the end of its field
Data must be at the end of its field
$
$
Example: pdf$
Example: pdf$
Grouping
Grouping
Use parentheses to create an item,
Use parentheses to create an item,
( )
instead of accepting the default
( )
instead of accepting the default
Example: Thank(s| you)
Example: Thank(s| you)
Use brackets to create a list of items to match
Use brackets to create a list of items to match
[ ]
[ ]
Example: Option [ABC]
Example: Option [ABC]
Use dashes with brackets to extend your list
Use dashes with brackets to extend your list
-
-
Example: [A-Za-z]
Example: [A-Za-z]
Repeat the last “piece” of information a specific
Repeat the last “piece” of information a specific
{}
number of times
{}
number of times
Example: [0-9]{4}
Example: [0-9]{4}
Other Characters
Other Characters
Turns a regular expression character into an
Turns a regular expression character into an
\
\
everyday character
everyday character
Use in Google Analytics filter to reference a
Use in Google Analytics filter to reference a
$A1
$A1
matched group
matched group
.*
Matches everything
.*
Matches everything
\d
\d
Use these shortcuts to denote a Digit, Space, or
Use these shortcuts to denote a Digit, Space, or
\s
\s
Word Character (letters/numbers)
Word Character (letters/numbers)
\w
\w
Check out our blog for more
tips:
Check out our blog for more
tips:
GA, AW, and GTM Trainings:
GA, AW, and GTM Trainings:

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2