简体   繁体   中英

Use Regex to match beginning and end part of URL in Google Analytics

I'm looking for a regex function to implement in a goal for Google Analytics.

Consider this URL: /dagje-uit/....variable part..../contact/vpv/bedankt

Regex should work when beginning of URL matches /dagje-uit/ and end part contains /contact/vpv/bedankt Everything in the middle can be variable.

Without result i've tried

(?=^/dagje-uit/.*)(?=.*/bedankt$).*

(?=^dagje-uit.*)(?=.*bedankt$).*

Thanks in advance! Regards, Pim

Forgive me if Google Analytics has some regex standards which I am overlooking but is it possible that your regex is failing because it does not account for the start of the whole of the URL? Adding .* to either end of your regex may help.

It also looks like your regex is over-complex for the conditions you have described. Could a simpler match be :

.*/dagje-uit/.*/contact/vpv/bedankt.*

or

http(s)?://.*/dagje-uit/.*/contact/vpv/bedankt.*

if you want to be a little more confident that it is a valid URL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM