[ic] RegEx Comparison

Mark Johnson mark at endpoint.com
Fri Oct 9 13:42:27 UTC 2020


On 10/9/20 9:39 AM, mihai at airdelights.com wrote:
> Hello,
> 
> The following piece of code is supposed to compare the response message from an HTTP GET request to a value obtained from the previous webpage, using the CGI tag.
> 
>      'res_msg' : variable which holds the response message
>      'order' : variable which holds the order number from the previous page
> 
> [if scratch res_msg =~ /[cgi order]/]
>      [warnings message="Tracking email for [cgi order] successfully resent"]
> [/if]
> 
> If all goes well, the 'res_msg' will contain the order number. However, I cannot get the regex comparison to return true in the if statement. I have tried manually inputting the order number as follows...
> 
> [if scratch res_msg =~ /{actual order number}/]
>      [warnings message="Tracking email for [cgi order] successfully resent"]
> [/if]
> 
> ...which worked fine, meaning that the 'res_msg' variable is working fine. I can also see that the 'order' variable contains the order number since I am printing it in the warning message.
> 
> My question is, does the CGI tag do something funky to the text to where I cannot compare it in that manner? How would I go about extracting the order number from [cgi order] to be able to check it against 'res_msg'?
> 
> Any help or advice is greatly appreciated. Thank you.

Mihai,

You can't use positional parameters when you need interpolation. You'll
have to restructure your [if] tag to use named parameters and put the
fields you require to be interpolated in quotes -- any of ', ", or |.

Thanks,
Mark


More information about the interchange-users mailing list