Hi,
I'm quite new to access (4-5 months) and RegEx.
I've searched the internet so much over past few days, tested with regex101.com and I can't get it right.
I have a regex module which lets me use it in access as a function.
I have a few suppliers, and their bar codes are all different, with the GS1 identifiers in different places.
02050604029067253700000100 - Supplier 1
370091919322223002 - Supplier 2
020761303548292020031520090037801092651042d - Supplier 3
I want to capture the below
02 - GTIN of Trade Items Contained in a logistic unit - Format - n2+n14 (Always 14 digits)
Original Expression: 02(\d{14})37
Internet sourced expression: /^02(\d{14})/
10 - Batch or lot number - Format - n2+an..20 (Up to 20, but not exceed 20)
Original Expression: 10(.{6,10})$
Internet sourced expression:/^10([^\u001D]{1,20})/
11 - Production date (YYMMDD) - Format - n2+n6 (always 6 digits)
Original Expression: 11(\d{6})10
Internet sourced expression: None
15 - Best before date (YYMMDD) - Format - n2+n6 (always 6 digits)
Original Expression: 15(\d{6})[10,11]
Internet sourced expression: /^15(\d{6})/
37 - Count of trade items contained in a logistic unit - n2+n..8 (Up to 8 digits)
Original Expression: 37(\d{4,8})
Internet sourced expression: /^37(\d{1,8})/
00 - SSCC (Serial Shipping Container Code) - Format - n2+n18 (always 18 digits)
Original Expression: ^00\d{18}|^.{18}$
Internet sourced expression: Didn't have to find one, this one seems to work fine.
The regular expressions I had already were aimed for Supplier1, and don't seem to take into account all other combinations. (I didn't write them, and I'm struggling to modify them.)
So, how do I write these to take into account all combinations, that each identifier might appear in each others string, and to be consistent? Is this a task for a high end programmer, and not an amateur like me, as I have seen a few posts with similar problems where C# and Python developers struggle? Am I aiming too high for my current abilities?
Or is it just as simple as me getting the syntax right?
For example, I tried 37(\d{2,6})(91|02|11|12|13|15|17|20|99|10)
02050604029067253700000100 - Supplier 1
Captuered: 00000
Should capture: 00000100
370091919322223002 - Supplier 2
Captured: 0091
Should capture: 0091
020761303548292020031520090037801092651042d - Supplier 3
Captured: 80
Should capture: 80
PS. I only have VBA and access available to me, no other languages etc.
I'm quite new to access (4-5 months) and RegEx.
I've searched the internet so much over past few days, tested with regex101.com and I can't get it right.
I have a regex module which lets me use it in access as a function.
I have a few suppliers, and their bar codes are all different, with the GS1 identifiers in different places.
02050604029067253700000100 - Supplier 1
370091919322223002 - Supplier 2
020761303548292020031520090037801092651042d - Supplier 3
I want to capture the below
02 - GTIN of Trade Items Contained in a logistic unit - Format - n2+n14 (Always 14 digits)
Original Expression: 02(\d{14})37
Internet sourced expression: /^02(\d{14})/
10 - Batch or lot number - Format - n2+an..20 (Up to 20, but not exceed 20)
Original Expression: 10(.{6,10})$
Internet sourced expression:/^10([^\u001D]{1,20})/
11 - Production date (YYMMDD) - Format - n2+n6 (always 6 digits)
Original Expression: 11(\d{6})10
Internet sourced expression: None
15 - Best before date (YYMMDD) - Format - n2+n6 (always 6 digits)
Original Expression: 15(\d{6})[10,11]
Internet sourced expression: /^15(\d{6})/
37 - Count of trade items contained in a logistic unit - n2+n..8 (Up to 8 digits)
Original Expression: 37(\d{4,8})
Internet sourced expression: /^37(\d{1,8})/
00 - SSCC (Serial Shipping Container Code) - Format - n2+n18 (always 18 digits)
Original Expression: ^00\d{18}|^.{18}$
Internet sourced expression: Didn't have to find one, this one seems to work fine.
The regular expressions I had already were aimed for Supplier1, and don't seem to take into account all other combinations. (I didn't write them, and I'm struggling to modify them.)
So, how do I write these to take into account all combinations, that each identifier might appear in each others string, and to be consistent? Is this a task for a high end programmer, and not an amateur like me, as I have seen a few posts with similar problems where C# and Python developers struggle? Am I aiming too high for my current abilities?
Or is it just as simple as me getting the syntax right?
For example, I tried 37(\d{2,6})(91|02|11|12|13|15|17|20|99|10)
02050604029067253700000100 - Supplier 1
Captuered: 00000
Should capture: 00000100
370091919322223002 - Supplier 2
Captured: 0091
Should capture: 0091
020761303548292020031520090037801092651042d - Supplier 3
Captured: 80
Should capture: 80
PS. I only have VBA and access available to me, no other languages etc.