Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Remove single character between spaces in a string

mellata
5 - Atom

Hi,

 

I have a dataset which has strings in the format below

 

ABCDE F GHIDJ

AB C DEFGHIJ

ABCD E FGH I 

 

I would like to find a way to only remove the character that is by itself.

 

ABCDE F GHIDJ --> ABCDE GHIDJ

AB C DEFGHIJ --> AB DEFGHIJ

ABCD E FGH I--> ABCD FGH

 

I tried used the RegEx tool however am not really sure how to use it.

 

Thanks for the help in advance!

7 REPLIES 7
cmcclellan
13 - Pulsar

2018-04-24 14_59_27-Clipboard.png

 

Use it like this:

 

Regular Expression is   <space><dot><space>

Replacement Text is <space>

 

the result is:

 

2018-04-24 15_01_37-Clipboard.png

ponraj
13 - Pulsar
 
mellata
5 - Atom

What is the difference between the first option (Space, dot, space) and second option which is : (.*)\s[[:alpha:]]\s(.*)?

cmcclellan
13 - Pulsar

I don't think there's any difference, both examples will achieve the same result

Number4
8 - Asteroid

Hate to resurrect an old thread, but I have multiple single letters that I need removed.  I've tired both options listed here, and they only remove the first single letter found.

For example, I want to remove the two single letters below.  And the single letters vary.

 

WORD J ANOTHERWORD H

cmcclellan
13 - Pulsar

@Number4 it's always best to start a new thread for your new problem.  It helps with getting the right answer to your problem 🙂 

pratiksondkar
5 - Atom

I tried both approaches. It is not giving the desired result if the input is like this :

 

Input :

A BCDE F GHIDJ K

AB C DEFGHIJ

ABCD E K FGH I 

 

Desired Output :

A BCDE GHIDJ 

AB DEFGHIJ

ABCD FGH  

 

Appreciate any other workarounds.

 

Labels