JA1
JA1

Reputation: 568

Substring to capture one or two digits

I'm using Nintex Build String action with the inline function of fn-Substring. When the input is as follows it works without issue.

062015Z062215Zjun16

Result 06

The problem is arises when the date is a single digit it will not be preceded with a 0 so the capture is incorrect

62015Z62215Zjun16

Result 62

I'm not sure how to fix the capture.

Upvotes: 0

Views: 67

Answers (1)

SamWhan
SamWhan

Reputation: 8332

Something like this maybe...

^(\d{1,2})\d{4}Z

Dont know whats constant in your string, but this assumes year always is four digits and followed by a Z. If the Z isn't constant, maybe [A-Z] or something like that will do it...

Check it out here at regex101.

Upvotes: 1

Related Questions