LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding Exact String Match

Solved!
Go to solution

I am searching an array of strings that are more than one word. I want to find a specific string in the array, and only that specific string, nothing else. I tried various ways of searching but am not having luck. Below is an example:

 

Array of Strings:

[0] test_lets develop software

[1] lets develop software

[2] test_no more developing software

[3] no more developing software

 

In this case I specifically want to find the index that would match "lets develop software" but not the "test_lets develop software" as a match either. If I try searching for "lets" I get both of them as a match. if I try searching for "test_lets" i get the correct one as a match.

0 Kudos
Message 1 of 11
(321 Views)

You could look for the value and the string length of both. This way if the incoming string is longer than the match it would ignore the match. You could also do it the simple way. 

 

aeastet_0-1753207633965.png

 

 

Tim
GHSP
0 Kudos
Message 2 of 11
(314 Views)

While this is a good idea, I still have to have the entire string as the search term and not just a portion of it. The rest of my code relys on the portion of it being a "key word" so I was hoping to keep that key word the same.

0 Kudos
Message 3 of 11
(307 Views)

What makes the test_let's correct over seeing both? If we understand why one is wrong then we might be better suited to help find a solution. 

Tim
GHSP
0 Kudos
Message 4 of 11
(277 Views)

OK How about using a reg ex to do the job. I believe this is doing what you want.

aeastet_0-1753211536805.png

 

Tim
GHSP
0 Kudos
Message 5 of 11
(270 Views)

You mean like this:

Search Example Snippet.png

0 Kudos
Message 6 of 11
(242 Views)

they are similar processes. they have similar names but are not the exact same in the way they are run. so the selection has to be particular to that slightly different one.

0 Kudos
Message 7 of 11
(210 Views)

It will be better to share what you have tried so far, So that we can suggest best way to do from what you have tried to what you have achieve.


----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 8 of 11
(203 Views)

@LearningLabVIEW wrote:

they are similar processes. they have similar names but are not the exact same in the way they are run. so the selection has to be particular to that slightly different one.


Did you look at my second code example with the reg ex. You can type in Lets and it will find the one with test_ before it? I even made the search term a control so you could change that if you want to. I was using the word no and it would find the array value that had test_no in it.

 

Search Example ver 4.png

Tim
GHSP
0 Kudos
Message 9 of 11
(175 Views)

OP, please type out exactly what you're looking for. Give us a list of items, your desired search term, and which one SHOULD be the correct result. Please give at least 2-3 examples here.

 

For right now, if you need EXACTLY the same string, just use paul's method (Equals or Search 1D Array). It sounds like it's not actually "exact" matching though that's what you said in the title.

0 Kudos
Message 10 of 11
(161 Views)