LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding Exact String Match

Solved!
Go to solution
Solution
Accepted by LearningLabVIEW

Your goal is a bit fuzzy (to us).

 

I wouldn't use a reg.ex. as it complicates things a lot once the search string can include special characters. Of course, searching for a reg.ex. could be a feature, but if you need to search for the exact string, that string can include *, ?, ., etc. and the reg.ex. will treat them as special characters, and not search for the exact string... You can of course escape all those special characters, but that's complex.

 

Here's how I'd search an array of strings for an exact string, returning the first index, or -1 if no match is found:

Search Array Of Strings For String.png

 

Note that the search and replace is not set to reg.ex.. Turning it on (right click) changes this and you'll be seaching by reg.ex..

 

Also note the replacement string is the search string. This can be a lot more efficient for large input strings, as the result string (if a match is found) doesn't change size. This won't help (and probably hurt) when searching for a reg.ex..

0 Kudos
Message 11 of 11
(65 Views)