09-10-2012 03:50 PM - edited 09-10-2012 03:52 PM
Hello,
I have a Zebra printer string that contains tokens I want to search for.
^BY2,3,55^FT50,219^BCN,,Y,N..^FD>:[[Serial Number 1]]^FS
^BY2,3,55^FT525,221^BCN,,Y,N..^FD>:[[Serial Number 2]]^FS
^FT170,192^XG000.GRF,1,1^FS
^FT220,430^A0N,27,27^FH\^FD2 ea. #00931 Battery/Cartridge Kit^FS
^FT350,460^A0N,27,27^FH\^FD#00602^FS
^FO10,32^GB780,480,8,B,1^FS
^FT720,500^A0N,10,10^FH\^FD[[Date Code]]^FS
I want to find any instance of the double brackets regardless of the text in between the brackets. I can find [[SerialNumber 1]] for example, but I also want to scan the whole string and make sure that there are no instances of [[any text]] left in the string. I haven't been able to build a regular expression that will find these.
Solved! Go to Solution.
09-10-2012 04:07 PM - edited 09-10-2012 04:07 PM
If you are using the Match Pattern, you can put it inside of a while loop and use the Offset Past Match into a shift register to start looking for the rest.
09-10-2012 04:10 PM
You are not going to have 1 regular expression to find all instances. Sicne you got the first message, you have a working regular expression. Assuming you are using Match Pattern, use the offset past match output to wire into the offset input of the next match pattern. This will start the search at a certain point in the string (after the match you just found).
If you use a while loop, as long as offset past match is >=0, you found a match. Once it is negative, there was no match. Pass the offset past match in a shift register which is initialized to 0.
09-11-2012 06:40 AM
09-12-2012 11:39 AM
All good suggestions. srikrishnaNF's example set me to thinking and I came up with a solution that solved another problem at the same time. Thanks guys.