I need to compare strings for a search mechanism on a web site. I use C#. I tried two ways:
consultants.Where(x =>
x.Description.ToLower().Contains(v
Indexing is a big part of searching. I think you would be best served by using something ready and solid, like Lucene or Solr.
If you still insist on searching using regexes on non-ascii characters, you should probably learn more on unicode categories and then use them to strip any accent marks (for example, strip with \p{P}
or \p{M}
) before searching for that word in the text.
Note: You will also probably need to normalize your strings using the FormC flag in order to decompose and strip/search more effectively