[ic] Regular Expressions in Conditionals

mihai at airdelights.com mihai at airdelights.com
Mon Sep 28 21:33:44 UTC 2020


Hello,
 
I'm fairly new to working with Interchange and am running into a syntax issue.
 
The problem I am trying to solve is deciphering between tracking numbers from two different shipping companies, and displaying a different message depending on which company the tracking number belongs to. Each company has its own set of rules for how the tracking number is structured, so its fairly straightforward to use a regular expression in order to pick apart the number.
 
I am using the "if" ITL Tag in order to check the variable against the regular expression, but I am running into a comparison issue. The line is "[if tracking_number =~ /^[0-9]{12}$/]" and it should return true if the characters are between 0-9 and the number is 12 digits long. Is it possible to compare a variable to a regular expression in the "if" tag? If so, am I doing the regular expression comparison incorrectly? 
 
Best,
Mihai Dan
Air Delights
mihai at airdelights.com



More information about the interchange-users mailing list