Parsing GS1 Barcode

Parsing GS1 Barcode

Hello, I am building a simple application to capture inventory and location. The user would scan the item barcode and location barcode and would sumbit the form. I need help parsing the data. Here is a sample of an entry: 
90I-3110-991010222179550
90 identifies the Item Number, which is I-3110-99
10 identifies the Lot Number, which is 1022217
95 identifies the Location Bin, which is 50

My issue is that the Item Number and Lot Numbers can be variable in length and Identifiers digits can also be part of the Item Number, Lot Number, Location Bin. For example: first occurrence of 10 is part of the Item Number followed by a Lot Identifier and then also first 2 digits of the lot number. 

Any good methodologies on how to parse the data?

Thanks!