0

I have this code

string regex = Convert.ToString(itemDtlValid.Value); 
string input = itemLst.Value;  
string strRegex = "^[a-zA-Z0-9\\r\\t\\n ./?;:\"'`!@#$%^&*()\\[\\]{}_+=|\\\\\\-~,]*$";             
Regex re = new Regex(regex);
int comparer1 = regex.CompareTo(strRegex);
int comparer2 = String.CompareOrdinal(regex, strRegex);

data in the right column is the value that i have in db for itemDtlValid.Value:

enter image description here

itemDtlValid.Value i got from db which have same value as strRegex.

But then when i compare those two strings, comparer1 and comparer2 don't return 0.

Does anyone know why this happen? How to get comparer1 and comparer2 to return 0?

stuartd
  • 70,509
  • 14
  • 132
  • 163

0 Answers0