Is there a complete guide containing all regex characters and their meaning in Tealium?

david_roose
Rookie Contributor
david_roose
For example, the Google Analytics regex guide (Perl-based): https://support.google.com/analytics/answer/1034324?hl=en Optionally, it may be sufficient to state on which programming language it is based, as there are books available on this topic, for example: http://shop.oreilly.com/product/0636920023630.do
6 REPLIES 6

Is there a complete guide containing all regex characters and their meaning in Tealium?

Tealium Employee
Hi David, Since Tealium is JavaScript based, it uses the JavaScript regex engine. Any regex you enter in the Tealium UI is parsed and converted into a standard JS regex before execution. Using the leading and trailing forward slashes is optional, unless you want to use a modifier such as "/g" or "/i". You can find a full JS regex reference here: http://www.regular-expressions.info/javascript.html Hope this helps. Craig.
Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

Is there a complete guide containing all regex characters and their meaning in Tealium?

fiann_ohagan
Employee Emeritus
fiann_ohagan
This is also a useful resource, which can show why your regular expression is (not) matching. http://regexponline.com/

Is there a complete guide containing all regex characters and their meaning in Tealium?

brian_greig
Silver Contributor
Silver Contributor brian_greig
One of my favorite resources is: https://regex101.com/#javascript . Great tool for testing your regex before implementing in production.
If I have seen further it is by standing on the shoulders of giants

Is there a complete guide containing all regex characters and their meaning in Tealium?

ksugam
Silver Contributor
Silver Contributor ksugam

I am reviving a very old thread but since its related to regex, I chose to mention here-

Has anybody faced utag.js errors on firefox and safari browsers due to negative lookbacks in regex. It caused an issue on one of my publishes as Chrome works perfectly fine.

I am trying to write a regex within a load rule to make sure the URL follows below pattern-

subdomain.abc.com (should match)

www.abc.com (should return false).

 

Hence I built a regex using regex101 as- 

[a-z]+(?<!www)\.abc\.com

This works fine for chrome but fails to compile on firefox and safari due to negative look back (?<). 

Can anybody help me with this

ksugam

Is there a complete guide containing all regex characters and their meaning in Tealium?

Tealium Employee

Hi @ksugam,

Is it possible to use something like [a-z]+([^www])\.abc\.com to meet your needs?

Tested in FF:

var a = /[a-z]+([^www])\.abc\.com/;

a.match("www.abc.com") //false
a.match("somedomain.abc.com")//true

*Chrome is the only browser that supports lookbehinds from ECMA2018 from what I read.

Is there a complete guide containing all regex characters and their meaning in Tealium?

ksugam
Silver Contributor
Silver Contributor ksugam

Thanks Michael. Works now on all browsers.

ksugam