I have regex patterns (about 100 or so) which are implemented using Regex class in C#. Now I want to give different weights when my input strings hit different patterns, for instances:
input_string = "xxxx... ";
weight=0.;
Regex name_exp=new Rex("pe[t,e]er|j[o,0]hn|may|....");
if (name_exp.Match(input_string).Success==true);
{
weight = ( 0.5 if it hits pe[t,e]er, 0.3 if it hits j[o,0]hn...)
}
How do you design a program to do it in a better way, since I have 100 patterns, to list all of them is not very efficient. I am also thinking about using map. But can the map index be a regex ? Thanks