11-07-2024 02:53 AM
Hi, I'm developping a .vi to parse error codes from a result log file with the Match Regular Expression function.
The input is a string which contains the log file text and the output is an array of clusters and each element of the cluster is a submatch returned by Match Regular Expression.
Basically, I pass the string into a while loop, check for a match and repeat the operation until there are no more matches
When I run my vi the first time it works perfectly but if I run it another time the match regular expression throws error -4600 and for some reason the offset past match is -1 which means there is not a single match, which is strange because there was at least one match the first time.
I added another Match regular expression block at the beginning to check if there is at least one match and as you can see in the image there is one. But the second Match regular expression block tells there is no match with the exact same input string and regular expression. What is happening?
Please try out the attached vi, the text I used is already inside.
I use Labview 2020.
Solved! Go to Solution.
11-07-2024 03:45 AM - edited 11-07-2024 03:49 AM
The error comes from a negative value for the "offset" input. The feedback node remembers the last value across runs.
Either keep the offset in a shift register
or initialize the feedback node when the loop starts. Right-click the node and select "Move Initializer One Loop Out" to get the terminal.
11-07-2024 03:53 AM
It worked, thanks a lot for your help.
I didn't know the feedback node remembers the last value from the previous run.
11-07-2024 04:00 AM
Hi caenem,
@caenem wrote:
I didn't know the feedback node remembers the last value from the previous run.
That's the (main) purpose of shift registers and feedback nodes…