Welcome to WebmasterWorld Guest from 23.20.215.116

Forum Moderators: DixonJones & mademetop

Message Too Old, No Replies

RegEx for repetition of /

     
10:23 pm on Apr 26, 2013 (gmt 0)

Junior Member

joined:Dec 15, 2011
posts: 66
votes: 0


I'm trying to figure out how i can do an advanced filter in GA on just urls that have one / (the first /), and no more. I don't want any subdirectories coming up.

I tried various things such as:

/{1}
/{0}

and others but nothing seems to work... any ideas?

thanks
1:42 am on Apr 27, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:13210
votes: 347


If it boils down to a pure Regular Expression question I can help you figure it out. But I'd need more information because I'm sure there is some syntax that's specific to GA.

Viewed purely as a RegEx, the form
/{1}
would mean "one slash" -- with no information about what comes before or after. So there could be any number of slashes, either contiguous or scattered about.
Similarly, the form
/{0}
would mean, well, basically nothing.

If I were doing your search in raw logs, I would look for

^/[^/]+$

replacing the + with a * if I wanted to include requests for the front page (expressed as slash alone). The foregoing is not literally true, since each line of logs contains several categories of information. It's not just the request by itself. But the principle is there.