12 Feb 2021 07:57 PM - last edited on 30 Sep 2022 12:01 PM by MaciejNeumann
Hi - I am quite new in the regex area - maybe stupid question...
I would like to convert price from cart - obtained by CSS selector to double (or integer) property.
The format I am getting from HTML is "1 234,56 €". Ideal match is "1234.56" - but I can live also with "1234 ".
Is it even possible to perform via regex in Application - Capturing - Session and user action properties - Custom properties - Apply cleanup rule ??
Currently I am able match either "1" or "234" 😞
THX, Josef
Solved! Go to Solution.
12 Feb 2021 08:26 PM
I recommend trying out www.regex101.com Your can supply your string and then test regex to parse out the data you are looking for 🙂
12 Feb 2021 09:07 PM
You could use something like:
([^€]++)
Would not remove the whitespace and keep the " , ".
You could also use this web to test the regex, since DT regex is kinda "limted"? https://35.201.104.155/ anyway. That is something close to test in real time the results.
14 Feb 2021 10:28 AM
Thank you Dante,
the DynEx at https://35.201.104.155/ is really great tool - even from learning perspective.
Anyway I was not able to remove space (and was able to remove ",56"). Transformation of result in form "1 234" to double property is leading to DoubleProperty = "null".
Currently I am matching just "234" and using parallel string property. In USQL I an adding then 1000 or 2000 according to "StringProperty" like "1 *" or "2 *". Quite dirty solution 😞
Hopefully in future I will be able to get data from server side as request attribute.
BR, Josef
16 Feb 2022 11:10 AM
Looks the Dynatrace regex tool is not working now 😞 😞
https://35.201.104.155/ gives ERR_CONNECTION_CLOSED
Do we have any replacement for it ? It was very usefull for me ...