You are viewing limited content. For full access, please sign in.

Question

Question

Workflow Parse String Into Date

asked on April 18, 2017

Hello, 

I have files named like:

XYZ-01021985

XYZ-01031985

XYZ-01041985 

etc ...

 

What I'm trying to do is assign a template which has two fields

Name 

Date

 

I can get the XYZ part from pattern matching, and I have also gotten the date string from pattern matching but I can't seem to assign it to the date field. 

 

Workflow says its not in the correct format, which I'm guessing is exepcting the '/' between the Monday Day and Year, 

 

 

0 0

Answer

SELECTED ANSWER
replied on April 18, 2017 Show version history

Use the Entry Name and the Token Editor

Name Token = %(Entry Name#<^(.*)-\d+>#)

Month Token = %(Entry Name#<.*(\d\d)\d\d\d\d\d\d$>#)

Day Token = %(Entry Name#<.*(\d\d)\d\d\d\d$>#)

Year Token = %(Entry Name#<.*(\d\d\d\d)$>#)

 

To explain, let's start at the end.  "$" means the end of the input. "\d" means any digit.  The "(" & ")" go around the information in the pattern that you want to return. The ".*" means anything 0 or more times.  And finally, "^" means the beginning of the input.

Then to find the name, we go from the start of the input and grab anything until we find a dash followed by 1 or more digits.  To find the month, we get the left most 2 digits of an 8 digit string starting from the end of the input.  To find the day, we get the left most 2 digits of a 6 digit string starting from the end of the input.  And to get the year, we get the 4 digits at the end of the input.

1 0

Replies

replied on April 19, 2017

Juan Angulo,

 

I'm going to make some expressions on this webpage.

http://mywebpages.pe.hu/PatternMatching.html

 

 

2 0
replied on April 25, 2017

Thanks!

 

This actually really helped me with another regular expression problem I was having. Thanks again. 

0 0
replied on April 26, 2017

Glad for you ^^

0 0
replied on April 18, 2017

Yes, you need to get the individual components of the date and rebuild it in your field with added slashes.

1 0
replied on April 18, 2017

How would I go about parsing that out though? I'm familiar with the "At Index" and it would be great if this had some sort of delimiter but it doesn't 

 

like i could use \d\d to get the first 2 digits and call it the month 

but then how do i get the day and year out?

0 0
replied on April 18, 2017 Show version history

Hi Juan,

 

Using Pattern Matching, you can use this expressions and save your value in token

Pattern Matching 1 (source file name)

Token Month => \d{2}

Token1 Day => \d{6}$

Token Year =>    \d{4}$

 

Pattern Matching 2 (source Token 1 Day)

Token2 Day => \d{2}

 

Rename

Token Month + "/" + Token2 Day + "/" + Token Year

0 0
replied on April 18, 2017

Thanks everyone for the answers. Eventually I'll get these regular expressions correctly

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.