Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
tolange
Partner Ambassador
Partner Ambassador

Regex parse for quotes in Qlik App Automation

Hi, I am trying to match part of a load script looking something like (in the form that one gets in when using the apps API): 

"[...] This is where the var gets defined\r\nLET vMinDate = '1994-01-01'; [...]"

I want to extract the part where the variable is defined and later replace it.

I tried the following regex but somehow this does not work: (LET\s+vMinDate\s*=\s*'([0-9]{4}-[0-9]{2}-[0-9]{2})')

Trying (LET\s+vMinDate\s*=\s) matches LET vMinDate =, (([0-9]{4}-[0-9]{2}-[0-9]{2})) matches 1994-01-01, so the problem seem to be the quotes ('). (I also tried double quotes, same result).

I always get following output: "{regexparse: ' . JSONPath('$.vLoadScriptTest', $outputs) . ', (LET\s+vMinDate\s*=\s*'([0-9]{4}-[0-9]{2}-[0-9]{2})')}"

Does somebody know how to correctly handle/escape them? 

Thanks!

Labels (1)
2 Replies
AfeefaTk
Support
Support

Hi @tolange 

Please share more details regarding this issue.

  • What is the expected result vs the actual result?
  • Attach the automation workspace and failed automation run json file.

Thanks

tolange
Partner Ambassador
Partner Ambassador
Author

Hi Afeefa, thanks for reaching out. I was i the meantime able to resolve this myself - it's pretty simple as all the character escape logic is not needed. One can just have spaces and quotes in the regex and it works.