Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Remove a text partially

ivoiculescu2020
8 - Asteroid

Hello,

I need your help with removing a text partially from rows: for example, I need to remove any text before "LF" in a row. 

For example, I have these 3 texts:

abcdfgrLFxyzw

fgtrVHbnLF56thfi

bGNTzucd456

For the first row: I need to remove abcdfgr and keep only LFxyzw

For the 2nd row: I need to remove fgtrVHbn and keep only LF56thfi

I used RegEx to remove any text before LF BUT now I noticed that the rows that have no LF are marked as Null:

When I use the RegEx, the 3rd row appears as Null instead of showing up exactly as is: bGNTzucd456

 

How do I remove the text before LF only in the rows that have LF in them and not affect the other rows (that don't have this text LF in them)?

 

Your help is greatly appreciated!

Kind regards,

Ioana

5 REPLIES 5
atcodedog05
22 - Nova
22 - Nova

Hi @ivoiculescu2020 

 

You can use an If statement to check if LF exist and apply regex only on them.

 

IF Contains([Input], "LF") 
THEN REGEX_Replace([Input], ".*(LF.*)", "$1") 
ELSE [Input] ENDIF

 

Workflow:

atcodedog05_0-1626167738322.png

 

Hope this helps : )

 

OllieClarke
15 - Aurora
15 - Aurora

Hi @ivoiculescu2020 

If you set up your RegEx tool like this it should work:

OllieClarke_0-1626168200705.png

 

Ollie

 

ivoiculescu2020
8 - Asteroid

@atcodedog05 thank you so much for your help! It worked! I didn't know that we could combine both the IF statement and RegEx. I learn new things every day it seems!

Have a wonderful day!

ivoiculescu2020
8 - Asteroid

@OllieClarke hello! thank you for your help! it worked!!! and it was so easy. It seems I wasn't using the RegEx at its full capacity. I wasn't seeing the forest from the trees.

this solution is quite fast and efficient. I appreciate your time!

Regards,

Ioana

atcodedog05
22 - Nova
22 - Nova

I can agree on that @ivoiculescu2020 lot of different possibilities to explore 🙂

 

Happy to help : )

Labels