Site: Mixing the CSS selector with Regex

Hi,

I love the site command, I've just seen it on the notifications, thank you. I've created the very simple command to extract the name from our Support system based on the css person-name. This then gives me the full name contained with in. That's great, but I'm looking just for the first name, or more simply the first string of text before the space.

I think using the regex ^\s would stop a text search at the first space, but I can't see if there is a way to combine the two. It feels as if it's either pulling from CSS or searching for a string, as they are two different commands.Is this possible, please?

Unfortunately, there isn't a unique set of characters before the first name. My next step will be to see if I can do something based on a bracket after the name. So 'Firstname surname (email@', to pull out the first name only based on that. :slight_smile:

Thanks for anyone support anyone can give

Thanks
James

Hello James,

You can combine the {site} command with the extractregex function, for example:

{fullName={site: text}}
{firstName=extractregex(fullname, "^(\S+)")}

You can combine that logic with anything else you need, so you could also get the full name and remove the email if it contains it, or get only the email.

Perfect thank you. I'd not used or looked at the those sections. Thanks!