I suck at Regex, please help

I need a regex to setup a filter for a view in Google Analytics. I admittedly suck at writing regular expressions and could really use some help.

The regex will be applied to the request URI (everything after domain.com/). I have a site with a wordpress front end and a forum in a subdirectory. Setting up the view filter for the forum portion was easy. The wordpress view is difficult because I need to exclude the home page.

The site is setup as follows:

Homepage: http://www.domain.com/ and http://www.domain.com/index.php

Forum: http://www.domain.com/forums

Wordpress: any url that is not in the sub directory http://www.domain.com/forums and is not the homepage. If you're not familiar, the wordpress URLs would simply contain query strings params off the main URL.. so something like http://www.domain.com/?p=1 and http://www.domain.com/?author=1

I'm thinking a regex that would exclude a URI with a path and only include URIs with a query string, would do the trick. but writing that is out of my league.

Thanks in advance.

Posted Mar 18, 2015, 10:05 PM UTC

43
Jafferwaffer•

Try this site! https://regex101.com

3
_JackOP•

That's, that helped a lot. I was able to get the regex I needed

2
logic_programmer•

There's a few topics in programming that people find hard when they don't have the necessary theoretical background. Knowing how to define regular languages is one of them. A good book on compiling will teach you how regular languages can be defined and recognised. It's one of those things that really is worth putting the time and effort into learning and learning well.

tl;dr Put the effort into learning about regular languages and reap the rewards.

0