01-31-2013 03:44 PM
I have a Zebra printer string I want to parse out some information from, but I can't get a single regex to do it.
The string is like the following;
^FT342,695^A0N,83,81^FH\^FDS/N : [[WIDGET]]^FS
^FT793,1170^A0N,67,67^FH\^FD1 ea. #00123 Widget^FS
^FT793,1170^A0N,67,80^FH\^FD2 ea. #00456 Widget Deluxe^FS
^FT793,1170^A0N,67,90^FH\^FD#0789^FS
I want what is in red. It will vary from label to label. I will use the results to display to the user which label he is printing. What is in blue doesn't vary, if that helps any.
Thanks for any help!
Solved! Go to Solution.
01-31-2013 04:04 PM - edited 01-31-2013 04:07 PM
Here is a fast way to get the last portion of the label format. You would still need to do something to ignore the first entry which you indicated you didn't care about.
01-31-2013 04:23 PM - edited 01-31-2013 04:23 PM
Here would be a way using regular expressions. Again, you will need to ignore the first entry and this version will add an empty entry in the last position of the array. You wil have more entries if your label contains more than what you posted..
02-01-2013 07:33 AM
I didn't know about using the regex option for search and replace until seeing Darin's example posted here.
There are probably more robust regex strings that could be used, but this example works...
02-01-2013 08:32 AM - edited 02-01-2013 08:35 AM
I posted it in the regular expressions thread 🙂
02-01-2013 09:29 AM
Mark,
You put a colleague and I on the right track. We came up with this, that ignores the lines without the # sign. The blank entry at the end of the array is no problem.
Not sure why the FD and FH have to be [F][H] and not [FH], but it works. Thanks to all. And where is the regex thread? I couldn't find it.
02-01-2013 10:29 AM
Here is a link to the Regular Expressions thread:
http://forums.ni.com/t5/BreakPoint/Regular-Expressions-Board/td-p/1187799
02-01-2013 10:33 AM
Oh wow! Whole bunch of new stuff! I thought that board had to do with some kind of hardware called Breakpoint. 🙂
02-01-2013 11:30 AM
That's where you go when you need to take a break... You can discuss anything, even giving someone a bunch of Kudos 😉