LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using "scan from file", is there a "format string" that will stop at a pattern

I'd like to use the "scan from file" primitive to identify (and stop at) a pattern of characters.
My goal is to avoid loop-logic required by "match pattern" string function.
Is there a "regular expression"/"format string" that will cause a scan to stop at a specific pattern of characters?
Thanks,
Bill C.
0 Kudos
Message 1 of 3
(2,901 Views)
When you mention not using "Match Pattern" you are referring to that vi, right?

So, do you mean something like:
using "Match True/False String" where you feed your string which is read from the file and you wire the string you want to match at (let's say) "true string" and you wire the selection (which is a boolean TRUE if/when match is found) to the STOP if TRUE of your loop.

The above is if you are using a loop. But if I read correctly, you don't want to use a loop. Is that correct?

If you are looking for a string, then you can use the "Match Pattern" vi without any loop. It will give you the matched substring, and you can read and feed the entire string to it.

Are the "specific pattern of characters" control characters? or a string? I am not awa
re of the vi that would stop a scan. But you can implement a solution based on your desired pattern.

Maybe we should suggest such a thing as an Express VI. It would be very useful.

-JLV-
0 Kudos
Message 2 of 3
(2,901 Views)
Hi Joel,
Thanks for the reply.

If anyone can/will share an example where "scan from file" is called, once, with a format/expression string that causes "scan from file" to return everything in the file up to a pattern of characters (such as "DATA")- that would be nice!

I resorted to building the ugly "match-pattern" loop. It will search binaries (reads blocks of chars, not "lines") and has a switch for a case sensitive search-option.
0 Kudos
Message 3 of 3
(2,901 Views)