Quantcast
Channel: Data Preparation & Blending discussions
Viewing all articles
Browse latest Browse all 4999

REGEX and padding

$
0
0

I'm trying to learn REGEX and I was wondering its usefulness with dates.

 

I have some hypothetical dates I want to convert to Alteryx's Date format.  Currently I'm using this formula:

 

REGEX_replace([Field1],'(.*?)/(.*?)/(.*)','20$3-$1-$2')

 

I don't know how to pad the left of the day and month portions.  Is there a way?

 

 Starting Date Current Conversion  Desired Conversion 
 2/3/16 2016-2-3 2016-02-03
 2/13/16 2016-2-13 2016-02-13
 12/3/16 2016-12-3 2016-12-03
 12/13/16 2016-12-13 2016-12-13

 

I'm sure that there are some great macros that convert dates, but i am only doing this to teach myself the how i can better use REGEX.


Viewing all articles
Browse latest Browse all 4999

Trending Articles