From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

matching same string twice

Solved!
Go to solution

I have a problem with a matching string VI. I want to compare a substring, let's say it is "This is my substring" which are included twice in a larger string.

I can match the first one but I don't know how to continue search for the second. I need to PASS this search whenever both substrings are found.

0 Kudos
Message 1 of 3
(2,257 Views)
Solution
Accepted by topic author hasse

It would help if you would show some code so we can see what tools you are using, there are many different ways to do this.

 

For example match pattern has an offset input, so all you need to do is call it a second time with the offset set past the first match. (more generally, you would use a loop and shift register to find all matches this way).

 

You can also use " Search and replace string" with your pattern (set "replace all" to true) and it will tell you how many it replaced.

Message 2 of 3
(2,252 Views)

Thanks, I used your tip with replace, even though I didn't replace anything I used the count output to see that it was dicovered twice.

 

0 Kudos
Message 3 of 3
(2,227 Views)