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

Regex help?

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi all,

 

Im a bit stucked with a regular expression.

 

/sv/sok/lagenheter/11713/brandbergen/skorpionens-gata-531 (Should be included)
/sv/sok/lagenheter/11741/brandbergen/jungfruns-gata-405 (Should be included)
/sv/sok/lagenheter/11741/brandbergen/jungfruns-gata-405/bilder (Should NOT be included)

 

My regex so far will cover them all:

sv\/sok\/lagenheter\/\d\d\d\d\d\/(.*)

 

In other words, I want to cut the next level folders in the URL. Would appreciate your help!

 

Best,

John

Re: Regex help?

Follower ✭ ✭ ☆
# 2
Follower ✭ ✭ ☆

Hi John,

this regular expression should work correctly:
(sv\/sok\/lagenheter\/\w+\/\w+\/[\w-]+)

You can test the regex here, if you like

Let me know if further help is needed!

Kind regards,

Elena

Re: Regex help?

Follower ✭ ✭ ✭
# 3
Follower ✭ ✭ ✭
Kudos Elena,

a data AND regex goddess, quite great!

Best regards and kotau

Arne
P.S.: John: http://www.annielytics.com/blog/analytics/regular-expressions-dont-use-google-analytics-without-them... (still great from the excellent and wonderful Annie Cushing aka Annielytics)
http://measureschool.com/resources/regex/ (quite nice, especially the guide from Aleksandr Pasters: http://www.apasters.com/blog/regex-guide-google-analytics-tag-manager/)
Marked as Best Answer.
Solution
Accepted by topic author Akelius A
July 2016

Re: Regex help?

Follower ✭ ✭ ☆
# 4
Follower ✭ ✭ ☆
Thank you Arne!

your feedback is much appreciated!

Best,

Elena

Re: Regex help?

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Thank you Elena! This seems to work.

Best,
John

Re: Regex help?

Follower ✭ ✭ ✭
# 6
Follower ✭ ✭ ✭
Hi John,

how about giving Elena Kudos aka a Star and declare her answer the right solution?
Just to motivate her to answer questions in future...

...best regards

Arne

Re: Regex help?

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
Sure!

This was my first question here, didn't know that.

Best,
John

Re: Regex help?

Follower ✭ ✭ ✭
# 8
Follower ✭ ✭ ✭
Hi John,

great!
I think she'll appreciate it.

Have a great weekend

Arne

Re: Regex help?

Follower ✭ ✭ ☆
# 9
Follower ✭ ✭ ☆
Thank you John, and thank you again Arne!

It is always nice when somebody appreciates your help Smiley Happy

Have a nice weekend!

Elena