Slide 1

Slide 1 text

Irregular regex for regular people Slideshare.Net/MyriamJessier @myriamjessier | @chloeivyroseseo Myriam Jessier & Chloe Smith PRAGM & Blue Array

Slide 2

Slide 2 text

We will cover ➔Common questions people have ➔Common regex operators to help you survive ➔Advanced regex filters for SEO (Google Search Console) ➔How to use regex in Google Analytics and Google Search Console 2 ©Pragm | @chloeivyroseseo @myriamjessier

Slide 3

Slide 3 text

What we will not cover ©Pragm | @chloeivyroseseo @myriamjessier

Slide 4

Slide 4 text

In the event that the forces of darkness are accidentally summoned by your REGEX creation, this talk will not be helpful. 4 @chloeivyroseseo @myriamjessier

Slide 5

Slide 5 text

5 @chloeivyroseseo @myriamjessier

Slide 6

Slide 6 text

6 @chloeivyroseseo @myriamjessier

Slide 7

Slide 7 text

7 @chloeivyroseseo @myriamjessier

Slide 8

Slide 8 text

8 @chloeivyroseseo @myriamjessier

Slide 9

Slide 9 text

What do 'lazy' and 'greedy' mean in the context of regular expressions? 9 @chloeivyroseseo @myriamjessier

Slide 10

Slide 10 text

10 'Greedy' means match longest possible string. 'Lazy' means match shortest possible string.

Slide 11

Slide 11 text

The greedy h.+l matches 'hell' in 'hello' or in 'hellscape' but the lazy h.+?l matches 'hel'. 11 ©Pragm | 👿 @chloeivyroseseo @myriamjessier

Slide 12

Slide 12 text

Why is my regex extracting more than expected? 12 ©Pragm | If you are using a regex like .* that contains a greedy quantifier you may end up matching more than you want. @chloeivyroseseo @myriamjessier

Slide 13

Slide 13 text

The solution to this is to use a regex like .*? (aka the lazy one). ©Pragm | 13 @chloeivyroseseo @myriamjessier

Slide 14

Slide 14 text

Optimiser le contenu 14 @chloeivyroseseo @myriamjessier

Slide 15

Slide 15 text

This is a regex pattern 15 ©Pragm | @chloeivyroseseo @myriamjessier

Slide 16

Slide 16 text

Trying to read or write a regex can feel like trying to decipher Egyptian hieroglyphics. 16 @chloeivyroseseo @myriamjessier

Slide 17

Slide 17 text

Google Sheet Script To Convert Plain English Descriptions Into Regex Statements @chloeivyroseseo @myriamjessier

Slide 18

Slide 18 text

1. Enter a description (in English) of the Regex filter you need and you’ll get a properly formatted Regex. 18 @chloeivyroseseo @myriamjessier

Slide 19

Slide 19 text

2. The script uses OpenAI’s GPT3 machine learning model to convert standard English statements into valid Regex. 19 @chloeivyroseseo @myriamjessier

Slide 20

Slide 20 text

3.Danny, the creator has the best sales pitch for this thing: “Download a copy of my Google Sheet and script to put an end to your tears.” 20 @chloeivyroseseo @myriamjessier

Slide 21

Slide 21 text

La démonstration !

Slide 22

Slide 22 text

Regex for SEO 22 @chloeivyroseseo @myriamjessier

Slide 23

Slide 23 text

23 Regular expressions are one of the most powerful tools in the SEO toolbox. @chloeivyroseseo @myriamjessier

Slide 24

Slide 24 text

Find all the client queries on Google AFTER a purchase in Google Search Console. 24 ©Pragm | 🛍 @chloeivyroseseo @myriamjessier

Slide 25

Slide 25 text

25 ^(clean|broken|wash off|shattered|polish|proble m|treat|doesn't work|replace|doesn't start|scratch|repair|manua l|fix|protect|renew|covera ge|warranty)[” “] Remember, you need to select the REGEX option in the dropdown menu!

Slide 26

Slide 26 text

Common Regex Operators 26 ©Pragm | . A wildcard match for any single character. .* A match for zero or more characters. .+ A match for one or more characters. d A match for any single numerical digit 0-9. ? Inserted after a character to make it an optional part of the expression. | A vertical line or ‘pipe’ character indicates an ‘or’ function. ^ Used to denote the start of a string. $ Used to denote the end of a string. ( ) Used to nest a sub-expression. \ Inserted before an operator or special character to ‘escape’ it.

Slide 27

Slide 27 text

Google encourages SEO pros to share regex stuff on Twitter using the hashtag #performanceregex. @chloeivyroseseo @myriamjessier

Slide 28

Slide 28 text

In Google Analytics, it’s magical to find specific patterns. 28 ©Pragm | 🔮 @chloeivyroseseo @myriamjessier

Slide 29

Slide 29 text

You can use it to find all pages within a subdirectory, all pages with a query string, etc. 29 ©Pragm | 🪄 @chloeivyroseseo @myriamjessier

Slide 30

Slide 30 text

30 By default, UA treats a regex as a "partial match." The expression will be true if the pattern is contained anywhere in the data. @chloeivyroseseo @myriamjessier

Slide 31

Slide 31 text

31 In GA4, the default regex is a "full match." The data must exactly match the pattern you provide. @chloeivyroseseo @myriamjessier

Slide 32

Slide 32 text

GA4 has ‘Organic Social’ and ‘Paid Social’. When the source is a social network and the medium matches the following regular expression: ^(.*cp.*|ppc|paid.*)$ 32 @chloeivyroseseo @myriamjessier

Slide 33

Slide 33 text

We recommend using the “paid” medium for your paid social traffic with GA4. ©Pragm | 33 @chloeivyroseseo @myriamjessier

Slide 34

Slide 34 text

Match metacharacters 34 ©Pragm | ! Use the backslash (\) to escape regex metacharacters when you need those characters to be interpreted literally. @chloeivyroseseo @myriamjessier

Slide 35

Slide 35 text

For example, the dot in an IP address must be escaped with a backslash (\.) so that it isn’t interpreted as a wildcard. 35 ©Pragm | 🃏 @chloeivyroseseo @myriamjessier

Slide 36

Slide 36 text

If you use regex in a report in Google Analytics and then navigate away from that report, you will lose that filter. 36 @chloeivyroseseo @myriamjessier

Slide 37

Slide 37 text

Not so in Search Console. 37 @chloeivyroseseo @myriamjessier

Slide 38

Slide 38 text

If you use regex in a report in Google Analytics and then navigate away from that report, you will lose that filter. 38 @chloeivyroseseo @myriamjessier

Slide 39

Slide 39 text

Google Search Console imposes a character limit of 4096 characters. Yes, someone decided to find out.

Slide 40

Slide 40 text

Check for Potential Content Injections 40 ©Pragm | Use this regex .*viagra.*|.*cialis.*| .*levitra.*|.*drugs.*| .*porn.*| .*www.*www.* @chloeivyroseseo @myriamjessier

Slide 41

Slide 41 text

Use https://regex101.com/ to see your creations come to life. 41 ©Pragm | Don’t forget to test your regex, just to make sure… @chloeivyroseseo @myriamjessier

Slide 42

Slide 42 text

Real world use Create keyword sets that you can then use in Google Sheets, BigQuery, Tableau, Data Studio, etc. 42 ©Pragm | @chloeivyroseseo @myriamjessier

Slide 43

Slide 43 text

Find long-tail queries with Regular Expressions 43 ©Pragm | RegEx to match any query longer than 75 characters : ^[\w\W\s\S]{75,}$

Slide 44

Slide 44 text

Filter out users finding your website through “commercial” intent terms: 44 ©Pragm | .*(best|top|altern ate|dupe|alterna tive|vs|versus|rev iew*).* @chloeivyroseseo @myriamjessier

Slide 45

Slide 45 text

(?<=\.)(.*?)(?=\.) Lets you extract a domain name. ©Pragm | @chloeivyroseseo @myriamjessier

Slide 46

Slide 46 text

Compare Brand VS Non-Brand Traffic. Filter out brand terms to see the generic keywords you rank for. 46 ©Pragm | Example: hm|h&m|hennes| mauritz| @chloeivyroseseo @myriamjessier

Slide 47

Slide 47 text

©Pragm |

Slide 48

Slide 48 text

Bibliography Regex For SEO: A Guide To Regular Expressions (With Use Cases) A Marketer's Guide to Using Regex in Search Console [Video] - Annielytics.com Don't Be Tongue-Tied: Learn RegEx Patterns for SEO Beginner Guide To Regex For SEO - JC Chouinard Regular Expressions (RegEx) in Google Search Console - JC Chouinard https://riseatseven.com/blog/google-data-studio-case-when-stat ements/

Slide 49

Slide 49 text

New Bibliography Using CASE WHEN in Google Data Studio to Supercharge Your Reporting Irregular regex for regular people - brightonSEO online - October 2022 by Rough Agenda