09 Mar 2018 01:20 AM - last edited on 30 Sep 2022 01:18 PM by MaciejNeumann
We have customer with which we are monitoring RUM in some Applications using Dynatrace Managed, from one of this applications (in a certain page) we need to extract a User Name so this can be used as a User Tag for the Application; the Issue is that there is no alternative but to use a CSS Selector to extract the data, but the selector applies to more that just the User Name; so we are extracting something like this:
Welcome Mr(s): <User Name>, <Some User-Selected Welcome Phrase>, Change your Avatar (options).
We are having trouble extracting (or cleaning) this retrieved text (so we can just get the <User Name> as requested by the costumer); we tried with a cleaning rule like this:
Welcome Mr(s): ([a-zA-Z\s]*), Change your Avatar (options).
But Dynatrace refuse to accept this rule because of the additional parenthesis: “Regular Expression must contain only 1 capture group”.
What we can do to fix this? Or to extract more efficiently the User Name?
Solved! Go to Solution.
09 Mar 2018 09:32 AM
parantheses have a special meaning in regex.
plz try to escape them:
Welcome Mr\(s\): ([a-zA-Z\s]*), Change your Avatar \(options\).
14 Mar 2018 10:36 PM
Sadly, we have already perform your suggestion regarding the parenthesis and Dynatrace now is unable to retrieve anything.
15 Mar 2018 07:50 AM
i tested with an online regex tester(https://www.regexpal.com/):
your regex is incorrect. this one would work:
Welcome Mr\(s\): ([a-zA-Z\s]*), .*, Change your Avatar \(options\)