Click here to Skip to main content
15,901,001 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)

I need a efficient way match two text pattern that match common characters.


string text = "Poland vs Greece";
         string pattern = "Poland v Greece";

         Regex r = new Regex(pattern, RegexOptions.IgnoreCase);

         Match m = r.Match(text);
         ArrayList results = new ArrayList();
         while (m.Success)

             m = m.NextMatch();

         string[] matchesStringArray = (string[])results.ToArray(typeof(string));

         for (int i = 0; i < matchesStringArray.Length; i++)

Arsenal FC v Sunderland AFC
Arsenal v Sunderland
Arsenal FC v Sunderland V

Compare the above string using any pattern matching algorithm.

Send me reply as soon as possible. (I will be more humble next time.)

Thank you
Updated 9-Aug-12 2:16am
[no name] 9-Aug-12 7:40am    
So what have you tried to do for yourself? Where is the code that demonstrates your problem?

What happened to Google[^], is it broken at your side?

Try something by your side first, then post your questions if you get stuck'd somewhere.

This is not at all appropriate.

You can even try search on CodeProject[^] with same question and get many similar solved answers.
Share this answer
[no name] 9-Aug-12 7:55am    
Countered. I think that he would be better served searching his textbook for how to do his homework...
deepgalley 9-Aug-12 8:04am    
I tried lot if you know the answer then post it don't post some unwanted things.
[no name] 9-Aug-12 9:09am    
Following the forum posting guildlines would probably get you better answers.
Prasad_Kulkarni 9-Aug-12 9:18am    
Whatever you have tried it would be better you mention it in first version. My answer was for your first version. This is what you get if you post such questions again.
Manas Bhardwaj 15-Aug-12 3:07am    

Please have a look at Extended search method[^]

You can similarly create your own method for comparison. it's all depend on what you would like to achieve.

hope this link will help you,

-Amit Gajjar.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900