How to perform a literal match with regex using wildcard

Posted by kashif4u on Stack Overflow See other posts from Stack Overflow or by kashif4u
Published on 2013-11-03T15:51:39Z Indexed on 2013/11/03 15:53 UTC
Read the original article Hit count: 294

I am trying to perform literal match with regular expression using wildcard.

string utterance = "Show me customer id 19";
string pattern 1  = "*tom*";
string patter 2  = "*customer id [0-9]*";

Desired results:

if (Regex.IsMatch(utterance, pattern 1 ))
{
MATCH NOT FOUND
}
if (Regex.IsMatch(utterance, pattern 2 ))
{
MATCH FOUND
}

I have tried looking for literal match solution/syntax in wildcard but having difficulty.

Could you also enlighten me with with an example on possible Pattern Matching Strength algorithm i.e. if code match 90> select?

Note: I have table with 100000 records to perform literal matches from user utterances.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about regex

Related posts about design-patterns