I continue to have problems with using REGEX_EXTRACT in custom properties... here's the regex that I built to strip away the trailing part of a url (you can see it working) and how I used it mixpanel, but something is clearly wrong; last time I had trouble with escaping characters properly, but this is valid PCRE, so if that's the case it means that Mixpanel is not, in fact, using PCRE?
Vlad S. not sure what you mean when it's clearly wrong. What is it not doing? I have used this as a custom property to get the based domain without any parameters.
REGEX_EXTRACT(@"""{"label":"Current URL","propertyDefaultType":"string","resourceType":"event","type":"string","value":"$current_url"}"""@,"[^?#]+",0)
So the regex is [^?#]+
how is it wrong? and if it's wrong, why does it work in regex101?
to be clear, I expect the output to be the first part of the url (what's in the green in the first screenshot) but I just get (not set) in Mixpanel
I'm not saying your Regex is wrong. I'm asking what is wrong about it. what is not working (can't tell from your images)
ohhh... yeah, it just doesn't extract anything
when I did this:
REGEX_EXTRACT(@"""{"label":"Current URL","propertyDefaultType":"string","resourceType":"event","type":"string","value":"$current_url"}"""@,"(.*?)\/*([?].*)?",0)
which I think is a copy of yours, I agree I get no results. But I think you are missing the ^ and the $ in what you put in.
REGEX_EXTRACT(@"""{"label":"Current URL","propertyDefaultType":"string","resourceType":"event","type":"string","value":"$current_url"}"""@,"^(.*?)\/*([?].*)?$",1)
that is returning results.
đ€Š thanks, let me give it a try!
yep, user error đ
thank you!
đ€
Hi Vlad, My name's Scott and I'm a Support Engineer at Mixpanel â here to help. I'm sorry to hear about the trouble with the REGEX_EXTRACT feature. Diving right in, can you clarify which element or what text you want extracted from the Current URL property? If you could provide an example URL and the output you expect from the Regex, that would help me troubleshoot this further. I believe our Regex library should be PCRE compliant, so I will confirm that with our team. Thanks,Scott MarinoffSupport Engineer II --------------------đŹÂ Liked my support? Please share your feedback in the survey you'll receive soon.
in this particular case it was user error (see the thread)
but the character escaping in mixpanel regex is not the same as in standard PCRE, i've posted about it before, I've had to trial and error with escape sequences in order to get my regexes to work, because they would work on regex101.com but not in mixpanel
yeah, often have to "double escape" characters