Highlighted

Load rule add condition JS variable lenght equals 5

Silver Contributor
Silver Contributor

Hi all,

I want to create a load rule based on a string JS variable lenght, I want to fire the tag when the lenght of this string is equal to 5.

To do this, I try to use the condition  "regular expression",  and add 5 dots, however the tag it's fired even if the lenght it's more than 5.

regular expresssion.png

How can I create this condition?

Thank you,

2 REPLIES 2
Highlighted

Load rule add condition JS variable lenght equals 5

Tealium Employee

Hey @mike360

So what you need to do is either use ^.....$ or ^.{5,5}$.

 Some good sites to show you what is hapenning/and for testing JS regex:

http://francoislaberge.com/regulex
https://regexper.com/
https://regexr.com/

They both do the same, but the second, says repeat min/max times. 

Tealium iQ - Tag Management 2018-07-27 14-45-19.png

Adrian

Ask me anything Tealium related or Javascript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.
Highlighted

Load rule add condition JS variable lenght equals 5

Silver Contributor
Silver Contributor

Thank you adrian_browning, it works.