Home › Forums › Barcode Generator › GTIN Barcode using the Barcode Rules
-
AuthorPosts
-
Andrew Baxter
June 11, 2023 at 5:59 pmPost count: 1I am wanting to use a GTIN barcode for items with the following details:
02-ASN not active
15-BBD
37-Count
10-Batch/Lot
3102-Total net weight, 2 decimals
In order to simplify it, I have put the first 3 requirements into the Find text under the Barcode rules:
((02).*)((15).*)((37).*)
I have tried various ways of allocating the $1, $2, $3 to what I thought was the appropriate columns (Item GTIN Expression alone and as a combination with others, but I am not getting the expected result.
This is the sample text I am using: (02)09420036400(15)191017(37)20
Does this need to be developed? Or is this available out of the box? If so, what am I doing wrong? or am I missing something?
Thanks in advance.
Insight Works
June 12, 2023 at 7:42 amPost count: 3Hi Andrew,
To Match (02)09420036400(15)191017(37)20 you will need to change two things in your regex expression.
First, escape your parenthesis you are matching with backslashes. Regex will otherwise interpret them as a Matching Group.
Second, move your matching group (.*) behind the static prefixes to make sure you only pull in the values and not the prefix along into it. I.E., You wouldn’t want a quantity of (37)20, instead you want just 20.
Try this regex expression: \(02\)(.*)\(15\)(.*)\(37\)(.*)
Now if you have the batch and total net weight in your barcode as well make sure to take that into account in your regex expression because the Barcode Rules above will grab everything after (37) as the %3 value. So if your barcode also contains the groups ’10’ & ‘3102’ in the order your provided then do something like this:
\(02\)(.*)\(15\)(.*)\(37\)(.*)\(10\)(.*)
In this regex expression you will get all your required values for %1,%2,%3, and %4 will grab anything afterwards (10 & 3102).
You can use this third party website, https://regexr.com, to learn more about matching groups. I always recommend being as strict as possible to the same rules the barcode creator applies to the given barcodes.
-
AuthorPosts
- You must be logged in to reply to this topic.