Answer the question
In order to leave comments, you need to log in
Regex, how to write a regular expression correctly?
Syntax RE2!
Yandex.Metrika: https://yandex.ru/support/metrika/general/regexp.xml
Google Analytics: https://support.google.com/a/answer/1371417?hl=en
Examples: https://support .google.com/a/answer/1371417
Checking regular expressions: https://support.google.com/analytics/answer/293690...
#1 condition (the condition does not participate in the reg. expression) page1 -> page2
The first condition is passed with onclick
, the second, I think to write down with the help of the expression (Y. Metrika), since the return is implemented according to the "either-or" principle. If he did not return, I return in 25 seconds
! #2 condition - regular expression
Go back one steppage1 <- page2
Task: you need to write only page1 into the expression, in all its variations
page1 - page1/ - page1/index.html - page1/en.html
What comes to mind (page1<-page2) is ^/page1(/|/index.html|/en.html)$
updated
The problem is that there is no where to check
My second option: page1?(.|.*index.html|.*en.html)$
updated
The farther into the forest, the more firewood
RE2 is a fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE , Perl , and Python
updated
Moved the task to the editor: goo.gl /WM6kWM
updated
The task was solved by Sergey Koksharov : goo.gl/T19Hy1.*/page1/?(index.html|en.html)?(?!..)
Many thanks to everyone for the responses! I was close to
PS. Maybe someone will come in handy
Tools for creating and testing regular expressions (syntax re2)
1. erik.eae.net/playground/regexp/regexp.html
2. myregexp.com
Settings for the first and second items: checkbox on Global, uncheck the rest
3. regexstorm.net/tester is the best in my humble opinion
4. Chrome offline apps: https://goo.gl/dk6RHX
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question