URL Regex in webapp feedback/intercept project - URL parsing issue | XM Community
Question

URL Regex in webapp feedback/intercept project - URL parsing issue

  • 29 March 2019
  • 2 replies
  • 41 views

Userlevel 1
I am trying to parse a URL with a regex in Embedded Data in a Website/App Feedback/Intercept survey.

I have tried to parse both the actual URL and the URL that Qualtrics seems to read and understand:
* Actual (in browser): https://websites.connectcdk.com/wsm/index.do?webId=motp-nitrademo2&locale=en_US
* Pulled into Qualtrics Survey Data (a bunch of HTML garb): https://websites.connectcdk.com/wsm/route/base-view/hydraDashboard?configCtx={"webId":"motp-nitrademo2","locale":"en_US","version":"WIP"}

We have written the following regex to parse the HTML-ey URL: [^\\?]+\\?.*webId["\\%22\\%3A\\:\\=\\&]+([^\\&\\%]+)
...and it works in the Regex tester (https://regex101.com/), but when plugged into my intercept project it pulls the webId as "3A" when it should be pulling "motp-nitrademo2".

Help! We have been troubleshooting this for weeks now and can't seem to come up with the right regex..

2 replies

Userlevel 7
Badge +27
I assume you are doing this in JavaScript? Are you parsing the "pulled into Qualtrics Survey Data" url? If so, try just splitting on the = then use JSON.parse() on the second element in the returned array ([1]).
Userlevel 1
Turns out the regex was correct but this issue was related to being in a demo environment/URL weirdness.

Leave a Reply