cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Regex for session property ?

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

3 REPLIES 3

ChadTurner
DynaMight Guru
DynaMight Guru

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 🙂

-Chad

Anonymous
Not applicable

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.


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