Subtitles section Play video Print subtitles (gentle music) - [Brad] As you go to create your filters, it's very common, that you'll need to use regular expressions to really get them to do what you want them to do. And regular expressions are most commonly referred to as regex. And this is a language that is used to describe a search pattern. It allows you to use essentially very powerful wildcards. Let's say for example, that our office had the following IP address range. And we want to exclude this range from ever capturing data in Google Analytics. We would write regex, which would look like this. And here's how this breaks down. When we see the slash, this means that the character that comes after that slash, needs to be interpreted literally. You see, the period, is actually a regular expression for matching any single character. So if we simply left the dots in the IP address, then the regex would use that to match any other character. So we have to use that proceeding slash. Now at the very end, you'll see the d, which is shorthand for any number zero to nine, the list of numbers from zero to nine, and then the asterisk means zero or more of any character. And this will essentially allow us to capture that entire range of IPs in one simple format. Now regex can get incredibly complicated and this is by no means meant to be a comprehensive overview, there are plenty of resources right here and around the web to help you get familiar. But I do want to show you the ones that you'll encounter most often and the ones that are really relatively easy to use. The first is the pipe symbol. I use this one very, very often. And this is used to create an OR match. Let's say I'm setting up a filter and I want to include my blog, store and article directories. I would simply put blog pipe store pipe article, and now it's going to be blog OR store OR article. And this is important because sometimes when you create filters, you'll set up a filter for blog, then you'll add a new filter for store. But because filters fire an OR, they don't naturally create an OR mechanism. So if I filtered out blog and then I fired another filter for store, store's not going to exist because I've already filtered for blog. So at the very high level, I would create this filter with the OR statement. Next you can use a caret to indicate that something starts with this word. Let's say I had numerous contact pages. I had contact dash sales, contact dash customers, contact dash clients and so on. If I use the caret symbol contact, it's going to find anything that starts with that term. Contrary to that, I can use a dollar symbol at the end of a term to indicate that I want everything that ends in this word. So let's say I had a store dash order, contact dash order and so on, I would put the dollar sign and that would find anything that ends with it. And finally, when you include either letters or numbers in between a bracket with a dash symbol, you're going to create a list. If I had page dash AA, page dash AB, and so on, I could match that with the following regular expression. Now this is very touch and go with regular expressions, but these are the ones that you encounter most commonly. (gentle music)
B1 dash blog filter contact regular symbol Google Analytics Tutorial - Regular expressions 11 0 Summer posted on 2022/09/14 More Share Save Report Video vocabulary