c#.net

c#.net 정규표현식 글자비교

우유빛 2010. 8. 24. 16:40

void main()
{
         String[] Source = {"abcd","efgh"};
         String FindStr = "cd";
         compareString( Source, FindStr );
}

private bool compareString(String[] order, String word)
{
            foreach (string s in order)
            {
                //System.Console.Write("{0,24}", s);

                if (System.Text.RegularExpressions.Regex.IsMatch(s, word, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
                {
                    //System.Console.WriteLine("  (match for '{0}' found)", word);
                    return true;
                }
            }
            return false;
 }

private bool compareString(String order, String word)
{

            if (System.Text.RegularExpressions.Regex.IsMatch(order, word, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
                {
                    return true;
                }
            return false;
}