REGEX String (rather than comma separated list)

I am extracting the first letters of a string of words successfully using the following expression:

\b[a-zA-Z]

It returns the first letters of every word from a sentence but they are a list separated by commas. For example:

"Dr Peter Jones" will extract to “D, P, J” when I actually want “DPJ” (not a comma separated list)

I can achieve with find and replace removing the comma and space but this is a sluggish and seemingly inefficient way to so it.

Is there a change I can make to the REGEX to achieve this? Alternatively something more efficient?

Thanks

2 Likes

Have you checked out regex101.com? It’s awesome. They probably have exactly what you need.

This topic was automatically closed after 70 days. New replies are no longer allowed.