Alteryx Designer Discussions

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

Join us on Dec 2 for a half-day virtual analytics + data science event!
US & CA customers only

It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!

Parsing a specific number of characters within a string

7 - Meteor

Dear community,


Please I am having some difficulties using Regex to extract a specific part of a string field within my Data.

I have for example a field with the following string: 99999998_20180501_001_21_11+22_ORDERS


I will like to extract the Year and Month (marked in green) for each single record within that field. The field ist automatically generated and the date changes depending on the date of input of the record (YYYYMMDD), else the format remains the same for all the records. Only exception could be the prefix that could vary between "ORDERS" and "OFFERS"


I will appreciate your assistance.



Alteryx Certified Partner
Alteryx Certified Partner

Hello @Desa19,


I've put you two ways to get to the same info with some extra columns to classify by date.




If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


Alteryx Certified Partner
Alteryx Certified Partner

Hi @Desa19,


You could use the following expression to parse the YearMonth into a new column:






If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.




Alteryx Certified Partner
Alteryx Certified Partner

This can be done in a single Formula tool. This will work for the 8-digit date string in any position in the input string, as long as it is bound between two underscores.




7 - Meteor

@CharlieS @Jonathan-Sherman @afv2688,


please accept my appreciations for the timely assistance, I just successfully pulled the right results with all three options. 


@CharlieS @Jonathan-Sherman: your proposed solutions, though slightly different approaches nail the problem on the point with the exact solution.

@afv2688's Option broadens my scope further on how to correctly format the Regex Tool for other possible outputs.


Thanks for all