URL RegEx: How does it work? | XM Community
Solved

URL RegEx: How does it work?

  • 10 March 2021
  • 3 replies
  • 191 views

Badge +1

Hi there,
I'm trying to figure out how URL RegEx works.
My expectation: the RegEx is used on the URL. The match will be the variable value. Is here eventually my idea behind this functionality incorrect? I couldn't find a description.

I tried to identify the functionality by "try and error". So I'm using the following RegEx that should match the whole URL:
https://regex101.com/r/6moopu/1 ==> RegEx = ".*"

My setting in the intercept:
image.png
My setting in the survey:
image.pngMy Survey Data:
image.png
My expectation would be that the URL is captured in full_url. What is incorrect here? Anyone has an idea?
As you can see, the other functionalities (URL Parameter and Current Page URL) work. So the connection between intercept and survey should work as expected.

Best regards,
Dominic

icon

Best answer by Dominic 19 March 2021, 10:27

View original

3 replies

Userlevel 3
Badge +8

I'm not sure exactly what you are trying to accomplish. Are you looking to capture URL query strings? Passing Information via Query Strings (qualtrics.com)

Badge +1

Hi pogi,
exactly, I try to capture data from the URL but not necessarily query parameter.
Imagine e.g. the following URL: https://test.com/identifier:1234?item=123
Now you want to capture the value of identifier. My plan was to capture the "identifier:1234" with "identifier:[0-9]*?" and then map it in the survey to something more readable.
I would really appreciate if you have some further suggestions.

Badge +1

Hi everyone,
I finally found the solution myself. In my opinion, Qualtrics should add documentation on this point.
The URL RegEx does not capture the matching RegEx, it captures the FIRST capture group (as far as I've done testing).
Please see example here: https://regex101.com/r/dLXzPK/1
The RegEx matches "identifier:1234" and the first capture group matches "1234". The "1234" can be safed as internal variable.
I hope I could help someone with this.
Best regards,
Dominic

Leave a Reply