Analytics
1.9K members online now
1.9K members online now
Ask questions about filter set-up and issues with using filters in Google Analytics reports
 
Guide Me
star_border
Reply

Why doesnt my regex work? :/

Follower ✭ ☆ ☆
# 1
Follower ✭ ☆ ☆

this works in regexr but not GA :/

 

.*\/[\l\L](ogin.aspx)|.*\/[\d\D](ashboard.aspx)

 

Text to match

 

/rtocp/Login.aspx
/RTOCP/Dashboard.aspx

 

2 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Mike D
August 2016

Re: Why doesnt my regex work? :/

Top Contributor
# 3
Top Contributor
Hi, Mike D,

You've got some back slashes before some of your characters (ie. \l, \L, \d, \D). The back slash is an escape character in RegEx and is only used if you need to escape some special characters, for example the dollar sign ($) which in RegEx represents the end of a string. If you need to use a literal dollar sign, then you need to use a back slash before $ (ie. \$) and then you'd get the literal dollar sign.

So looks like maybe you should try something like this:

.*\/((l|L)ogin|(d|D)ashboard)\.aspx

Hope this moves you in the right direction.
Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn

View solution in original post

Re: Why doesnt my regex work? :/

Top Contributor
# 2
Top Contributor
Hi Mike :-)
What type of filter is it/what is it meant to be doing?

The following should work if the filter is NOT ticked to be case sensitive
/rtocp/(Login|Dashboard)\.aspx
Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here
Marked as Best Answer.
Solution
Accepted by topic author Mike D
August 2016

Re: Why doesnt my regex work? :/

Top Contributor
# 3
Top Contributor
Hi, Mike D,

You've got some back slashes before some of your characters (ie. \l, \L, \d, \D). The back slash is an escape character in RegEx and is only used if you need to escape some special characters, for example the dollar sign ($) which in RegEx represents the end of a string. If you need to use a literal dollar sign, then you need to use a back slash before $ (ie. \$) and then you'd get the literal dollar sign.

So looks like maybe you should try something like this:

.*\/((l|L)ogin|(d|D)ashboard)\.aspx

Hope this moves you in the right direction.
Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn

Re: Why doesnt my regex work? :/

Follower ✭ ☆ ☆
# 4
Follower ✭ ☆ ☆
thank you Nicky!