07-15-2014 11:58 AM
I am trying to figure out the format of a regular expression in order to pull select lines out of a multi-line string and populate those lines as individual elements of a string array while using Match Regular Expression. The overall length of the multi-line string can vary as well as the text contained within the string. The string can contain letters, numbers, and special characters. I have attached an example VI. Within the example VI I only want to return the lines beginning with "Device #" into the array. The number of lines beginning with "Device #" can vary but I want to capture them all.
Or is there a better function to use instead of Match Regular Expression that will give me the desired outcome?
Solved! Go to Solution.
07-15-2014 12:09 PM
Slight change to my example VI attached. This one gives me the match but it does not give the match + the rest of the line.
07-15-2014 12:09 PM
@aaronb wrote:
I am trying to figure out the format of a regular expression in order to pull select lines out of a multi-line string and populate those lines as individual elements of a string array while using Match Regular Expression. The overall length of the multi-line string can vary as well as the text contained within the string. The string can contain letters, numbers, and special characters. I have attached an example VI. Within the example VI I only want to return the lines beginning with "Device #" into the array. The number of lines beginning with "Device #" can vary but I want to capture them all.
Or is there a better function to use instead of Match Regular Expression that will give me the desired outcome?
Match Regular Expression works well for this.
Ben64
07-15-2014 12:26 PM
Thanks that works. I guess in my example I was missing the "+ .*" in the regex to include the rest of the line (thats the part I was trying to figure out)
Is there any drawback or difference when using the while loop example I have in the attached VI compared to your For loop example? Your For loop example seems cleaner and I will probably use that but I am trying to understand if there are any negatives in the While loop version.
07-15-2014 12:57 PM
07-15-2014 01:14 PM
OK thanks for all your help!