Customer Portal

Substring of Email Address

Comments 7

  • Avatar
    hesske
    0
    Comment actions Permalink
    I think I have found a way to do it via the replace expression. The one issue I've run into is there are a few cases where the domain is different than most of the email addresses. Trying to find a way to use a variable after the @ to get all characters after the @ sign.
  • Avatar
    hesske
    0
    Comment actions Permalink

    Trying to find a way to use a variable after the @ to get all characters after the @ sign.

    "hesske"


    Sorry, not a variable, but a wildcard to use.
  • Avatar
    hesske
    0
    Comment actions Permalink
    Just wanted to let everyone know I found a regex that accomplished what I needed. Here is my code:
    replace($in.0.EMAIL_ADDR, "@(\\w+.\\w+)", " "
  • Avatar
    Lukas Cholasta
    0
    Comment actions Permalink
    Hi hesske,

    You can accomplish this multiple ways. The most convenient seems to be to use split function. Please take this an example.

    string[] out = split($in.0.address, "@");


    Attached is an example graph.

    Best regards,
  • Avatar
    the_goat
    0
    Comment actions Permalink
    Well, there are many ways. Best performing might be your "excel" way:
    addr = left($in.0.email,indexOf($in.0.email,"@")-1);


    Lazy way might be what Lukas proposed:
    addr = pop(split($in.0.email,"@"));


    Or similarly:
    addr = pop(find($in.0.email,"^([^@]+)",1));
  • Avatar
    the_goat
    0
    Comment actions Permalink
    Oh, sorry. Instead of pop(), the function should be poll(), you want an element from beginning of list; not the end. Cannot edit the original post tho :(
  • Avatar
    hesske
    0
    Comment actions Permalink
    Thanks everyone for the good input. :)

Please sign in to leave a comment.