Alteryx Designer Desktop Discussions

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

Regex

SejalP1
7 - Meteor

Hi,

 

How can I extract the name from this by eliminating the date and time stamp:

 

input Required Output
A2B_EF_PQ_19072019_1520 A2B_EF_PQ_
   
ABC_DE_QR_19072019_1520 ABC_DE_QR_
   

 

 

Thank You!

4 REPLIES 4
MichalM
Alteryx
Alteryx

@SejalP1 

 

Assuming the pattern at the beginning of the string is always the same - 3characters_2characters_2characters the below Regex will work as well

 

(.{3}\_.{2}\_.{2}\_)

 

regex.png 

LukeM
Moderator
Moderator

@SejalP1 

 

Two ways to do this without Regex:

1. Assuming DateTimeStamp part is always the same length (as it should be), remove the 13 characters off the end:

  • Left([Field], Length([Field])-13 )

2. Split field on the '_' and then reconstruct using the fields you need

 

Alternatively you want to remove the the last part using RegEx. The code for this would be:

  • [0-9]{8}\_[0-9]{4}

Using the RegEx tool to Replace this with nothing or using RegEx_Replace() function in formula tool.

 

Hope this helps. Let us know how you get on.

 

Luke

grazitti_sapna
17 - Castor

Hi @SejalP1,

 

Try this.

Thanks.

regex.PNG

 

Sapna Gupta
SejalP1
7 - Meteor

@LukeM 

 

Works Perfectly. 

Thank You!

Labels