07-22-2025 12:44 PM
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.
Solved! Go to Solution.
07-22-2025 01:03 PM - edited 07-22-2025 01:07 PM
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.
07-22-2025 01:11 PM
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.
07-22-2025 01:57 PM - edited 07-22-2025 02:00 PM
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.
07-22-2025 02:12 PM - edited 07-22-2025 02:17 PM
OK How about using a reg ex to do the job. I believe this is doing what you want.
07-22-2025 08:49 PM
You mean like this:
07-23-2025 08:29 AM
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.
07-23-2025 09:07 AM
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.
07-23-2025 12:20 PM - edited 07-23-2025 12:33 PM
@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.
07-23-2025 12:43 PM
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.