RegEx ... targeting a URL structure - can't get it to work
I am trying to target certain URLs but I can not get it to work.
I want to target all URLs build up like this:
BUT do NOT include URLs like this:
So I tried around so many RegEx combinations, but cannot get the URL targeting to work properly....
What I tried:
Any idea what I am doing wrong here?
Any help is appreciated!
Solved! Go to Solution.
Thanks for your question!
I think what might help you is doing a quick and easy regex course: http://regexone.com/. It's very easy to quickly go through and allows you to do easy exercises too.
A regex that would work for you here is: www\.somedomain\.com\/fixed-subfolder\/.*\.html
The periods . and forward-slashes / have to be escaped, as they are special characters. Also, the asterisks denote that the character before it can occur 0 to many amount of times, so (*) means that the opening bracket ( can occur 0 to many times, then the closing bracket ) has to occur. The .* is what you're looking for, as the period . denotes any character, and the asterisk * denotes that any character may occur 0 to many times.
Then you can also use Optimizely's URL Match Validator to double-check that it works correctly.
I hope this helps!