Caret (^)

Created by: LunaMetrics on 20 February 2008
Last updated by: LunaMetrics on 20 February 2008

^ If anything comes before this character, the string is not a match to this Regular Expression

For example, let's say that you have two pages on your website, http://www.mysite.com/secondpage/contact/, and http://www.mysite.com/contact/.

Ordinarily, Google Analytics calls these pages /secondpage/contact/ and /contact/. That's because Google Analytics already knows about the domain, www.mysite.com.

If you want to find all the strings that start with /contact/ (the second option) but just put in that same line, /contact/ for your regular expression, you will get everything that can possibly match the string, which will include the one you don't want, /secondpage/contact/.

If you only want to match http://www.mysite.com/contact/, you can use regular expressions like this:

^/contact/

Two additional points:

1) Google Analytics already thinks in terms of relative URLs. It assumes the http://www.mysite.com, so when you ask for ^/contact/, it will come back and correctly show you strings that say /contact/.

2) Anchor carets are useful in other places besides just URLs. Let's say you want to create a filter for the entire range of IP addresses in your company. However, your IP addresses all start with a two-digit number, like 64.xx.xx.xxx, so you wouldn't want to filter out something that looked like this: 164.xx.xx.xx. To solve that problem, you can use a carat: ^64 etc.