Extract with Regex pattern

I need some help regarding Extract with regex.

I would like to Extract only alphabets from the source and show it in a input box. In the below mentioned screenshot, I need the first Four letters of the Name column to be only alphabets.

Every value after an underscore comes from a different column. The first four letters come from a column called name. This column contains spaces, and special characters.

For Eg:

Business Names

  1. Tom & Jerry company
  2. The - American - Bikes

Required Output

  1. TOMJ
  2. THEA

I need to remove spaces and special characters using regex, can someone help me with the regex pattern for the same.

@keith @NigelG @Bubble @fayewatson

1 Like

Easiest way is:

  1. Convert to Uppercase
  2. Remove special characters (find and replace (regex pattern ON) [^a-z\d_-]+ with (empty value)
  3. Extract first 4 letters (truncated to 4)

14%20AM

@JohnMark

I tried doing the same but the result was the following. can you help me further here?

this will work:slight_smile: (as you showed it’s not working because of spaces)

(edited)

  1. Find and Replace : space with empty
  2. Find and replace with [^A-z\d]+,
  3. uppercase and truncate.

1 Like

@JohnMark

Thanks for the updated regex pattern, this worked like a charm!

1 Like

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