Performing a split on Custom Variable

Is it possible to perform a spilt on custom variable. I have a custom variable called UserName which is a the first and last name of a user, and I need to perform a spilt to get the firstname and lastname into separate variables.

Hi @gdsTechJay

You can use a regular expression or text helpers to split a string. Regular expressions are more powerful, but also more complex, so I recommend a text helper in this case.

Assuming there is only 1 space in the name, you can use these:

{{before_string custom.username " " flags="t"}}

{{after_string custom.username " " flags="t"}}

Change custom.username to the variable containing the name. You can read more about before_string and after_string on the docs pages.

Could you show me an example using the user interface

Sure thing.

If you need more help, please provide the URL to the rule so I can see it in context.