RegEx in extension's condition

Bronze Contributor
Bronze Contributor

 Hi 

 

I have an extension in which I have to write couple of conditions in the configuration. In one of the condition, I have to write a RegEx.

 

I want to know that how to set the RegEx to a JavaScript variable in the configuration? My main purpose to write the RegEx is to trim out the domain from the URL and send the rest path to the siteCatalyst tag which assign the trimmed part of the URL to one of the Prop.

 

Thnx in advance..

1 REPLY 1

RegEx in extension's condition

Employee Emeritus

@Diconium-RO11

Great question. This is possible with a JavaScript extension.  However before going that far, I am wondering if you can use one of the built in Data Sources or join a couple of Data Sources together to get what you want.

 

For example find the section called "DOM ELEMENTS AS DATA SOURCES" in: 

https://community.tealiumiq.com/t5/Tealium-iQ/Data-Source-Types/ta-p/10645

These are bulit in data sources you can pass to vendors like siteCatalyst.

 

So lets say you have https://www.example.com/some_path/index.php?foo=bar&biz=baz

"dom.pathname" will be "/some_path/index.php"

"dom.query_string" will be "foo=bar&biz=baz"

 

Knowing this, you can utalize the Join Data Values Extension

make a destination of sc_url

join pathname and querystring with the delemiter ?

Now sc_url will be "/some_path/index.php?foo=bar&biz=baz" (no RegEx required :)

 

And then map the sc_url to a prop in the tag mappings.

 

Let us know if this works for you.

 

Brian

 

 

Public