Reputation: 519
I'm looking to do a top ten list of the main pages of a bio but not the additional subdirectories. E.g.
/cr/johndoe
/cr/janesmith
but NOT:
/cr/johndoe/news
/cr/janesmith/dvds
/cr/santaclaus/galleries/1
etc.
I've started with filters=ga:pagePath==/cr/*
but I'm not sure how to do the regex to get it to not go any deeper.
Upvotes: 1
Views: 1701
Reputation: 627110
In order to match the /cr/something
you can use the following filters:
filters=ga:pagePath=~/cr/[^/]*/?$
Or Url-encoded version:
filters=ga:pagePath%3D~%2Fcr%2F%5B%5E%2F%5D*%2F%3F%24
REGEX EXPLANATION:
/cr/
- matches the sequence of the characters literally[^/]*
- 0 or more characters other than /
/?
- 0 or 1 /
symbol$
- matches the end of string.If the URL starts with /cr
, add ^
(start of string):
filters=ga:pagePath=~^/cr/[^/]*/?$
or Url-encoded:
filters=ga:pagePath%3D~%5E%2Fcr%2F%5B%5E%2F%5D*%2F%3F%24
Upvotes: 1