community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Regex

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!

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 

Alteryx
Alteryx

@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

Alteryx Partner

Hi @SejalP1,

 

Try this.

Thanks.

regex.PNG

 

Meteor

@LukeM 

 

Works Perfectly. 

Thank You!

Labels