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.

Regex: extract MMM yyyy value from string

mbrenn207
6 - Meteoroid

Hi, I'm trying to extract the MMM yyyy value from a string where it can have multiple variations of formatting. Below are examples of the different variations I'm seeing and the desired output:

 

String valueOutput
252.204-7000 Disclosure Of Information (Oct 2016)Oct 2016
252.204-7003 Control Of Government Personnel Work Product Apr 1992Apr 1992
 ____ (14)(I) 52.219-6, Notice Of Total Small Business Set-aside (Nov 2020) (15 U.S.C. 644).Nov 2020
X (58) 52.232-33, Payment By Electronic Funds Transfer—System For Award Management Oct 2018 Oct 2018

 

The top 2 only differ where MMM yyyy is either in () or not.  I'm using \((.*?)\) to capture Oct 2016 but it will fail on the string without parenthesis.   The bottom 2 won't work either since there are 1 or 2 sets of parenthesis at the beginning of the string value so I'm lost on how to do this.  

 

Should I be using a Regex tool for this work or am I better off writing a formula to what I need? Any help is greatly appreciated!  

 

 

1 REPLY 1
atcodedog05
22 - Nova
22 - Nova

Hi @mbrenn207 

 

Here is a regex formula for the task.

 

REGEX_Replace([String value], ".*(\u{3}\s\d{4}).*", "$1")

 

Workflow:

atcodedog05_0-1625809140114.png

 

extracting 3 character space 4 number pattern.

 

Hope this helps 🙂

 

Labels