09-30-2021 04:06 PM
The string format is YYWWPXXXXM
YY-YEAR
WW-WEEK
P-PRODUCT
XXXX-BATCH NUM
M-MANUFACTURER
Examples are 2123A3456G, 2111G3463H, or 2019C4928P.
Since this is a mix of letters and numbers, how would I write this as a regular expression?
09-30-2021 04:14 PM
@mshaske wrote:
The string format is YYWWPXXXXM
YY-YEAR
WW-WEEK
P-PRODUCT
XXXX-BATCH NUM
M-MANUFACTURER
Examples are 2123A3456G, 2111G3463H, or 2019C4928P.
Since this is a mix of letters and numbers, how would I write this as a regular expression?
You're trying to pick this out of a larger string?
09-30-2021 04:18 PM
If that's all you're receiving, it's easier just to chop that up by offset.
09-30-2021 04:30 PM
With the Scan From String VI, you can use this format string, as long as there are no letters that will appear in the year, week or batch num fields.
%2d%2d%1s%4d%1s
09-30-2021 04:50 PM
If you're trying to parse each subfield, use aputman's Scan From String advice. If you're trying to ID your string in a big list of other strings, use this regex:
[0-9]{2}[0-9]{2}[a-zA-Z][0-9]{4}[a-zA-Z]
(Tip, use https://regex101.com/ to check)