Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RegEx extractions help text to show slashes don't need escaping #16604

Closed
utrautmann opened this issue Oct 23, 2020 · 3 comments · Fixed by #18043
Closed

Update RegEx extractions help text to show slashes don't need escaping #16604

utrautmann opened this issue Oct 23, 2020 · 3 comments · Fixed by #18043
Assignees
Labels
c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Milestone

Comments

@utrautmann
Copy link

I tried to use a regular expression to generate a value for a custom dimension from the URL.

Here I read that I should use a Regular Expression testing tool like https://regex101.com/ to prevent mistakes.
But my impression is that, for example, escaping an URL slash in Matomo is wrong and I have to do without backslashes instead.

URL: /de/area1/xyz.html or /de/area2/xyz.html

To extract area1 or area2 I have following regex:

Correct Regex: \/de\/([a-zA-ZäöüÄÖÜ-_]+)

Matomo regex that delivers the desired results: /de/([a-zA-ZäöüÄÖÜ-_]+)

Is the documentation with the reference to regex101.com not precise enough or is the regular expression implementation in Matomo different?

@tsteur
Copy link
Member

tsteur commented Oct 25, 2020

Thank you for creating the issue @utrautmann Likely this needs to be mentioned in the FAQ and is expected behaviour.

@tsteur tsteur added this to the 4.1.0 milestone Oct 25, 2020
@tsteur tsteur added the c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base. label Oct 25, 2020
@tsteur tsteur modified the milestones: 4.1.0, 4.3.0 Nov 25, 2020
@Findus23
Copy link
Member

This is kind of documented in https://matomo.org/faq/how-to/custom-dimensions-extractions/

Developers Note: You don’t need to escape forward slashes as Matomo does this for you automatically. e.g. use /news/ instead of /news/

One easy solution in regex101 is to set the delimiter left of the regex to something else than / (this way one doesn't need to escape it there just like in Matomo)

@tsteur
Copy link
Member

tsteur commented Jul 27, 2021

We only need to mention this in the inline help of the related form field that slashes don't need to be escaped

@tsteur tsteur added c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. and removed c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base. labels Jul 27, 2021
@peterhashair peterhashair self-assigned this Sep 19, 2021
@peterhashair peterhashair linked a pull request Sep 22, 2021 that will close this issue
11 tasks
@justinvelluppillai justinvelluppillai changed the title RegEx extractions to set a custom dimension value Update RegEx extractions help text to show slashes don't need escaping Oct 6, 2021
@justinvelluppillai justinvelluppillai modified the milestones: 4.7.0, 4.5.0 Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants