My site (ASP.NET + C#) has FAQ data pull from another site’s web service in XML format. The data size is pretty small (just about 50 faqs). I want to implement a keyword search for the FAQ and highlight the search keyword. What could be a fast and easy approach to do this?
My first thought is just using a C# string search or any XML search method. I know this is not scalable. But consider the FAQ is little, it may not need to index the FAQ. I could be wrong. Can anyone give me some suggestions? Thanks.
The best solution to this is using Regular Expressions. RegEx scales well too, so you don’t need to worry that much about speed. Using RegEx Replace, adding a tag around the matches to make them stand out is easy as well.
You can find a good RegEx tutorial here. It has good info about both general RegEx use, and that link goes to their explanation about .NETs implementation.
RegEx has a step learning curve, but it is worth the effort, because it is incredibly powerful.