Here i do a regular expression where _pattern is the list of teams and _name is the keyword i would like to find whether it matches the _pattern.
Result shows that it matched. I’m wondering why is it possible because the keyword is totally different to the _pattern. I suspect that it is related with the é symbol.
string _pattern = "Ipswich Town F.C.|Ipswich Town Football Club|Ipswich|The Blues||Town|The Tractor Boys|Ipswich Town";
string _name = "Estudiantes de Mérida";
regex = new Regex( @"(" + _pattern + @")", RegexOptions .IgnoreCase );
Match m = regex. Match (_name );
if (m . Success)
{
var g = m. Groups [1 ]. Value;
break ;
}
It has nothing to do with the é symbol. Let’s go over a few things..
Is it right that there are 2 | in as your questions formulates :
Also the point has special meaning in a regex so you should escape it
And alternatives should be enclosed with parenthesis:
The parenthesis in the following java line are not necessary
Aneway, The reason that it matches is not do to a valid regex. I think it has to do with your use of the java API.
The regex that I would rewrite for your purposes is:
As you can see, there are quit a few differences.