Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
Hi @tolange
Please share more details regarding this issue.
Thanks
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.