03-11-2009 08:06 PM
oops not file attached...
you have toi strip the .txt off. This damn browser I am using will not let me attach a .vi file.....sigh
03-11-2009 10:12 PM
ctbram,
The example string you want to match, <DESC>##Start#Next_State#State 1#</DESC> and your regular expression ("##>+.#<") don't match... you need ">" to proceed "##". You also need to allow for more than one character between the last "##" and the next "#". As posted your regular expression would match a string that contained ##, followed by one or more >, followed by one non-newline character, followed by #, followed by <.
The expression I came up with is this:
>##+.*#<
If you don't mean to match more than 2 #'s at the beginning, then the expression should be written as follows:
>##.*#<
I've attached a modified version of your example that will parse the entire string from file, and spit out matches. Note that you should not put quotes around your regular expression in the LabVIEW control, or it will turn it into a literal, and won't find any matches.
Hope this helps,
Dan
03-12-2009 12:25 AM
Thanks Dan.
Actually I just made a typo I was using the regexp >##+.#< so it looks like I needed the * to make the regexp >##+.*#<.
Thanks for the help. Now I have to parse out all the comments in XML and I am dreading it! With PERL or Python I could do the entire just in 15 minutes of coding but I am sure I will be pulling my hair out and have my blood sugar up to 600 and spend 18 hours on it today. lol
03-12-2009 12:46 AM
cbtram,
Sounds like a rough day... regular expressions give me enough trouble without trying to use them in an environment I'm not as familiar with! Why must all of your parsing be done in LabVIEW? Would it be possible for you to write a script do this for you, then invoke it in LabVIEW using System Exec.vi?
Dan
03-12-2009 09:49 AM
ctbram,
Will this do what you want? In earlier versions of LV regular expressions were not supported (or only in a fairly limited way), so we did things with simpler tools. I just matched "<DESC>##" before and "#</DESC>" after inside a loop. With a bit of juggling of the offsets past match it is pretty straightforward. If you want the <DESC> tags they can be appended back onto the strings easily.
Lynn