Showing results for 
Search instead for 
Did you mean: 

string matching

I am trying to quickly put this in labview. I was wondering if someone could help me with it.




I need to create a very quick string matching program find matching strings in a serial incoming string find matches against a database of words, and output 00 if there is no match or a match ID if there is a match.

sequence. The last valid character will be FF to indicate the end of the sequence. Need to



for example the data batabase of words is


MatchID     :    word


01             : and


02             : but


03              :cat


04              :mat


05             : sat




If I have


Input : the cat satttt on the mat


I should be able to get this match ID






Input :      the   cat   satttt on    the   mat


MatchID: 00   03    05    00    00   04




Thank you for your help.










0 Kudos
Message 1 of 9

try this

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
Download All
0 Kudos
Message 2 of 9

(I think it is a disservice to clutter a simple concept with baggage like state machines, local variables, unneeded timeout events and complicated extra loops and shift registers. "Array to spreadsheet string" and "spreadsheet string to array" can replace most of it. Also the above code does not work right, because it does not correctly parse the satttt as "05". We need to use "match first string" instead.)


Here's a quick draft. Use it as a starting point. You still need to detect FF, for example.


Download All
Message 3 of 9

Thanks guys, this is was so quick.


1 more and last think I forgot to ask:


How do I organise the database of words this way: the database will have a maximum of 2000 words. The longest word will have 12 characters.

But my problem here also is this: THE INCOMING STREAM WILL BE BUFFERED IN A MEMORY and the memory will be organized  as 1024x32 bit memory, thus 4 characters stored in each line of memory.


Just want to use power of labview to help me in my testing system.

Is it possible to get the address (from the memory of each words or characters stored?) this will help to get both ID or memery location.


Thank a lot for your help.



0 Kudos
Message 4 of 9

It sounds like you're buffering the incoming stream in memory on an external device.  What is this external device?  Does it have any functions for doing direct memory access, or maybe determining memory locations?  If not you might have to come up with some sort of system for determining the memory location of your data.  It seems like it could vary wildly based on the size of the word.

0 Kudos
Message 5 of 9

- There is no external device but at some point we could be using a system with a FPGA or some asic.

(in this case is it possible to buffer it in this device) and how to do this with labview?


- How to determin the memory location if I decide not to use the FPGA?



-How to represente a database of 2000  words?


Thanks for your help

0 Kudos
Message 6 of 9

I have a feeling that this task will vary wildly based on the actual external device you will be using, and what functionality this device has for directly accessing its memory.  As far as representing a database of 2000 words, it might be easier to maybe put some sort of character between each word in memory so you know where the spaces between words are, though that would increase the amount of memory you would need to store your words.

0 Kudos
Message 7 of 9

Thank you, the solution from Gaurav k is what I wanted. But I am stack again, don't see how to make it case Insensitive. seems a bit complicated.


Thank you.



0 Kudos
Message 8 of 9

Never mind, I solved the case insensitive thing.


Thank you.

0 Kudos
Message 9 of 9