Sundar,
This is exactly what the
Vision Development Module is designed for. If you do not have this software package, I would highly recommend getting it for this project.
Take a look at the pattern matching example program which installs with the Vision Development Module under:
C:\Program Files\National Instruments\LabVIEW 7.1\examples\Vision\2. Functions\Pattern Matching
Also Vision Assistant has a number of pattern matching examples in the Solutions Wizard. Look at Electronics >> Printed Circuit Board solution. It performs two pattern matches with two different templates.
Hope this helps. Good luck with your project!