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.