12-18-2012 09:43 AM
Hey Guys
I am controlling a setup that i built using labview. It is governed by a QSM that can read to commands from a text file. I inherited some code that reads a text file of the format "Some Command;", but this code requires that i only have commands in the text file that also end with ";". I have to write the text file manually so it would be nice to make it a bit more comprehendable. So added names and to identify those i use the ":" i can then remove them by using search and replace. But what how can i remove wite space or generic text like in the file that i attached?
also is there an easy way to make a command that also imports a value like "command, value =4" and then read the 4?
i hope you can help.
Atamsih
Solved! Go to Solution.
12-18-2012 10:10 AM - edited 12-18-2012 10:13 AM
12-18-2012 11:15 AM
12-18-2012 11:39 AM
@Atamsih wrote:
[...]
also is there an easy way to make a command that also imports a value like "command, value =4" and then read the 4?[...]
Here's a quick pass at this request, using Match Regular Expression:
12-18-2012 12:06 PM - edited 12-18-2012 12:07 PM
12-18-2012 01:37 PM
ShotSimon wrote:Can you explain "([^\v;]*)(?<!; )(\z|\v)" to people like myself who aren't familiar with it. Even after reading the documentation I am confused by this notation.
Don't you wish there was a graphical way to compose regular expressions. 😄
12-18-2012 02:05 PM - edited 12-18-2012 02:08 PM
@altenbach wrote:
Don't you wish there was a graphical way to compose regular expressions. 😄
https://decibel.ni.com/content/docs/DOC-13698
ShotSimon wrote:Can you explain "([^\v;]*)(?<!; )(\z|\v)" to people like myself who aren't familiar with it. Even after reading the documentation I am confused by this notation.
Big Picture: look for lines which do not end in ';' these will be replaced by empty strings
([^\v;]*) : grab characters 0 or more characters which are not vertical whitespace or ;
(?<!; ) : negative lookbehind for ; (keeps newline for lines ending in ; ) [this is tricky] [can be removed if you want a ';' delimited list]
(\z|\v) : grab the newline or end of string not preceded by a ';'
It takes a while to go from 'hocus pocus' to 'easy peasy'
Edit: Lithium thinks I wink a lot when I try to enter these regexes. and yes I mean
12-18-2012 02:13 PM
@Darin.K wrote:
([^\v;]*) : grab characters 0 or more characters which are not vertical whitespace or ;
One of the problems is for example that "\v" is not listed in the LabVIEW documentation.
12-18-2012 07:15 PM
12-18-2012 07:25 PM