Forum Academy Marketplace Showcase Pricing Features

Quick regex extract for first and last name

Hi Guys,

Just a quick tip for extracting the first and last name with a regex pattern using the :item expression.


Regex pattern: ([^\s]+)

Demo:
extract-names

Conditions could be used if the person just enters a first name or even if they enter a middle name…

Cheers

9 Likes

So many tips we continue to discover, even after so long! Great, thank you.

2 Likes

Thanks @JohnMark

So many possibilities with regex expressions.

2 Likes

For basic checking middle name or outputting dynamic content based on the input of the user, a condition such as this could also be beneficial:


extract-names-middle
Using :count or could use is empty to evaluate result

1 Like

Luke, if we wait a little longer, you’il uncover our genealogy🤣

2 Likes

Good one @eren :rofl:

1 Like

I will definitely use this in my latest projects.

1 Like

Hi Luke,

Thanks for sharing. But what if the person has 2 names e.g. Simon Peter? or what if the person has Jr. Sr. on their names? e.g. Simon Peter Sandler Smith Jr.

I’m now setting up a registration forms so I’m curious to know about this.

Thank you in advance.

Allan

1 Like