Regex Email Validation

Hi friends!

Glad to be using Text Blaze in my job again, I used it a ton at my old job! Trying to make the absolute best use of it now that I am at a tech company!

My use case here relates to populating user name and email addresses from a Zendesk ticket to my notes via regex.

Trying to figure out how to extract the first and last name. .mail .sender is the CSS element that contains that information. Is extracting this piece of information possible the same way that including {site: text} would work on an extractregex expression?

The regex email validation I am trying to use is located at regex101: Email address (most used), as it matches both my single word email address and my first.last work email address.

/^([\w-]+(?:.[\w-]+))@((?:[\w-]+.)\w[\w-]{0,66}).([a-z]{2,6}(?:.[a-z]{2})?)$/i

Any friendly input on how I can make this possible would be greatly appreciated. I don't assume there will be a cut and dry answer, but that is the biggest issue I am running into in attempting to work as smart as humanly possible.

Love the community here, love the MVP swag (still wear the shirt and use the mug), I trust you all!

Happy Tuesday,
-Christopher

Hey @crsauer91 , good to have you back in the forum.
Clarifying question: Is the email address found on the page? Are you able to extract the email address with {site: text} or a selector and try to use regex to read the relevant information from the email address? or are you trying to find a way to read the email address?

Hey! The email address will always exist on .sender .email element on selector which populates sender name, email address, and a hyperlink to change it in the UI.

I am looking to separate into customer first name, customer last, and customer email for the variables, disregarding everything else.

The use case is I am trying to automate notes and replies to customer. If I need to seek input, it would craft a Slack thread or easily call back the email address to verify what I am looking at, for example. The form would be in a note area on top of the page.

Thanks for the reply Dan!
-Christopher

Hey @crsauer91 ! Can you give a screenshot of how the .sender .email looks like? From your description, does it look like this: John Doe <john@acme.com>?

Hi Gaurang!


The section starts right after the bullet point, ending right before the "via".

Thanks for looking into this!

Assuming I understand your request correctly, does a snippet like this work for you?

{data="Sample customer customer@example.com"}
{firstname=split(data, " ")[1]}
{secondname=split(data, " ")[2]}
{email=split(data, " ")[count(split(data, " "))]}
{=firstname}
{=secondname}
{=email}

Hey bud!

This should work perfect, I'm going to test around with the data area to point to that area, but this should be fantastic! I'll be back if I run into issues.

Thanks for the time and care.

-Christopher

Just tried testing this out.

I could create a text field for the data area if needed and do a clipboard function, but I ran into an issue trying to use the site text command. The email address area pointed to an area called (Change) that is normally a hyperlink placed just to the right of the email address. It is not on the ticket I posted as it was a sample ticket, but the email area read that rather than the email address.

The split is otherwise a fantastic idea, do you think using regex to extract the email address would still work with this? I couldn't make it happen when I tried.

Thanks friends!
-Christopher

Hi @crsauer91

You can add minus one to the split array index for the email field, I have modified the sample snippet, please give it a try.

{data="Sample customer customer@example.com"}
{firstname=split(data, " ")[1]}
{secondname=split(data, " ")[2]}
{email=split(data, " ")[count(split(data, " "))]}
{=firstname}
{=secondname}
{=email}