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

Question

Question

Pattern Date

asked on February 1, 2018 Show version history

Hi all,

 

Using Workflow and Pattern Matching, is it possible to have an pattern with the actually year?

Example : Sentence : This is something 2016Ab123 and something else 2018Cd456.

Pattern : <year>\D{2}\d{3}

Result => 2018Cd456 (and not 2016Ab123)

 

I tried this but it looks doesnt work.

%(Date){4}$\D{2}\d{3}

 

Thanks in advance.

Regards

 

0 0

Answer

SELECTED ANSWER
replied on February 2, 2018

You can use the date token, extract just the year and use it in your regexp.
(%(Date#<(\d{4})>#)\w+) returns 2018Cd456

To do this check allow tokens in the pattern and  enter the %(Date) in the pattern line.
Select the 'Token Dialog' option
Highlight the date once that opens and apply a regular expression to the date,  (\d{4})
That will give you the %(Date#<(\d{4})>#)  (the year) in your pattern match and you can further construct your regexp.

~Andrew

1 0
replied on February 2, 2018

Thank you Andrew, It's working.

Regards

0 0

Replies

replied on February 1, 2018

You can't use %(Date) with Workflow pattern matching. 

You could try \d{4}\w{2}\d{3}

Otherwise, if you only want 2018 results and not 2016 results - 2018\w{2}\d{3}

 

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

Sign in to reply to this post.