You are viewing limited content. For full access, please sign in.

Question

Question

Regular Expression to retrieve the first letters of each word in a string

asked on October 27, 2023

Hello everyone.

I'm trying to find a regular expression that will allow me to retrieve the first letters of each word in a string, despite the number of spaces inside.

Example: "    This is           a 1 regular expression test.       "
Return: "Tiaret"

Does anyone have the expression?
Thanks in advance.

0 0

Answer

SELECTED ANSWER
replied on October 27, 2023 Show version history

Okay, I figured it out myself, and for those who want the answer, here it is.

I use the Pattern Match object and the expression: ([a-z]{1})[a-z]*\s*
You also need to select "All matches (combined without spaces)".
 

1 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.