Creating a pipeline rule with \\ in it

Ok, I’ve created a similar rule to strip the domain off when it is in the format of userid@domain.topdomain with no issues, but since \ is a special character I’m not having any luck with it here. I tried escaping it with dual \ but still gives me big read x’s in the rule creation:

The goal is to get a ‘common’ formatted username so in lookup tables I don’t have it in 3 formats of:
domain\username (note that is double slash as it is everywhere else here)
username@domain
username

Not to mention simplying searching.

rule “common-username-format domain\”
when
contains(to_string($message.username), “\”)
then
let res = split(“\”, to_string($message.username));
set_field(“common_username”, res[1]);
end

The when clause works as long as I escape it, but the let line isn’t happy.

Since the domain is a set length, I guess I could look at just chopping off the first X characters as a last resort, but test domains may cause issues.

So pipelines need to be escaped, and regex needs to be escaped, so sometimes you end up with crazy amounts of slashes. I cant remember for sure, but I think you may need to have 4 slashes, the regex needs to be escaped so thats 2 but then it needs to be escaped for the pipeline so each of those needs its own slash so you end up with 4

Thanks, the fix was four of them! Never would have come up with that.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.