Upgrade to Pro — share decks privately, control downloads, hide ads and more …

BrightonSEO Download This Regex Guide for SEO Pros

BrightonSEO Download This Regex Guide for SEO Pros

What's covered:
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

Myriam Jessier

September 06, 2024
Tweet

More Decks by Myriam Jessier

Other Decks in Marketing & SEO

Transcript

  1. 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
  2. In the event that the forces of darkness are accidentally

    summoned by your REGEX creation, this talk will not be helpful. 4 @chloeivyroseseo @myriamjessier
  3. What do 'lazy' and 'greedy' mean in the context of

    regular expressions? 9 @chloeivyroseseo @myriamjessier
  4. The greedy h.+l matches 'hell' in 'hello' or in 'hellscape'

    but the lazy h.+?l matches 'hel'. 11 ©Pragm | 👿 @chloeivyroseseo @myriamjessier
  5. 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
  6. The solution to this is to use a regex like

    .*? (aka the lazy one). ©Pragm | 13 @chloeivyroseseo @myriamjessier
  7. Trying to read or write a regex can feel like

    trying to decipher Egyptian hieroglyphics. 16 @chloeivyroseseo @myriamjessier
  8. 1. Enter a description (in English) of the Regex filter

    you need and you’ll get a properly formatted Regex. 18 @chloeivyroseseo @myriamjessier
  9. 2. The script uses OpenAI’s GPT3 machine learning model to

    convert standard English statements into valid Regex. 19 @chloeivyroseseo @myriamjessier
  10. 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
  11. 23 Regular expressions are one of the most powerful tools

    in the SEO toolbox. @chloeivyroseseo @myriamjessier
  12. Find all the client queries on Google AFTER a purchase

    in Google Search Console. 24 ©Pragm | 🛍 @chloeivyroseseo @myriamjessier
  13. 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.
  14. Google encourages SEO pros to share regex stuff on Twitter

    using the hashtag #performanceregex. @chloeivyroseseo @myriamjessier
  15. In Google Analytics, it’s magical to find specific patterns. 28

    ©Pragm | 🔮 @chloeivyroseseo @myriamjessier
  16. You can use it to find all pages within a

    subdirectory, all pages with a query string, etc. 29 ©Pragm | 🪄 @chloeivyroseseo @myriamjessier
  17. 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
  18. 31 In GA4, the default regex is a "full match."

    The data must exactly match the pattern you provide. @chloeivyroseseo @myriamjessier
  19. 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
  20. We recommend using the “paid” medium for your paid social

    traffic with GA4. ©Pragm | 33 @chloeivyroseseo @myriamjessier
  21. Match metacharacters 34 ©Pragm | ! Use the backslash (\)

    to escape regex metacharacters when you need those characters to be interpreted literally. @chloeivyroseseo @myriamjessier
  22. 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
  23. 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
  24. 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
  25. Check for Potential Content Injections 40 ©Pragm | Use this

    regex .*viagra.*|.*cialis.*| .*levitra.*|.*drugs.*| .*porn.*| .*www.*www.* @chloeivyroseseo @myriamjessier
  26. 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
  27. Real world use Create keyword sets that you can then

    use in Google Sheets, BigQuery, Tableau, Data Studio, etc. 42 ©Pragm | @chloeivyroseseo @myriamjessier
  28. Find long-tail queries with Regular Expressions 43 ©Pragm | RegEx

    to match any query longer than 75 characters : ^[\w\W\s\S]{75,}$
  29. 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
  30. 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
  31. 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/
  32. 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