LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exclude a phrase using Match Pattern

Good day all,

I need to take an array of arbitrary strings and match only those strings that do *not* contain a particular phrase ("AQL" in this case). I know it's possible to exclude single characters by using the tilde inside of brackest [~....], but is there some way to exclude entire phrases?

For example, "Am_AQL" should not match, but "AMQL" should match.

I'm starting to go crosseyed looking at this one, so any help would be appreciated!
0 Kudos
Message 1 of 5
(3,169 Views)
Why not just search for "AQL" and call it a match if it doesn't find it (Offset past match = -1)?

See the attached LV 6.1 example.
0 Kudos
Message 2 of 5
(3,169 Views)
Unfortunately, the pattern is generated in one code module and stored in a file. Later on, in a different code module, the pattern is applied to a set of strings. For all other cases that I have, the pattern is a standard match pattern.

Currently, the second code module only understands how to run a pattern match, not how to invert the results of a pattern match.

I was hoping to avoid having to integrate specialized code into my general search algorithm.
0 Kudos
Message 3 of 5
(3,168 Views)
I don't see it as "specialized code". The example I posted has a switch which can be set to include or exclude strings which match. You can set the default to Include and wire it to Exclude as needed. Depending on the strings you search for, you could include one or more characters at the start of the search string to indicate Exclude. E.g., you might code your search algorithm so that "AQL" means include strings with AQL, but "!AQL" or "!=AQL" means Exclude them. See the updated example.
0 Kudos
Message 4 of 5
(3,169 Views)
I understand what you are doing with it, I was just hoping to not have to modify code that is called between several existing systems. It's difficult to say what it might break.

My thanks for all of your efforts, they are appreciated!
0 Kudos
Message 5 of 5
(3,169 Views)