M
mp
any regex experts here?
trying to validate a string passed in to see if it refers to a valid excel
range name
"a1" or "A1" to "iv65536" or "IV65536"
this clearly isn't it, i'm a regex dunce!
Regex regex = new Regex("[a-zA-Z][a-iA-I][a-vA-V][1-65536]");
this is no good either
Regex regex = new Regex("[a-zA-Zaa-ivAA-IV][1-65536]");
bool b;
b = regex.IsMatch("x1");
Debug.Print(b.ToString());//true
b = regex.IsMatch("1a");
Debug.Print(b.ToString());//false
b = regex.IsMatch("AC65536");
Debug.Print(b.ToString());//true
b = regex.IsMatch("IV65537");
Debug.Print(b.ToString());//false
b = regex.IsMatch("IV65536");
Debug.Print(b.ToString());//true
any tips appreciated
i suppose i could parse the incoming string and separate the alpha and
numeric parts
but with regex that shouldn't be necessary, right?
thanks
mark
trying to validate a string passed in to see if it refers to a valid excel
range name
"a1" or "A1" to "iv65536" or "IV65536"
this clearly isn't it, i'm a regex dunce!
Regex regex = new Regex("[a-zA-Z][a-iA-I][a-vA-V][1-65536]");
this is no good either
Regex regex = new Regex("[a-zA-Zaa-ivAA-IV][1-65536]");
bool b;
b = regex.IsMatch("x1");
Debug.Print(b.ToString());//true
b = regex.IsMatch("1a");
Debug.Print(b.ToString());//false
b = regex.IsMatch("AC65536");
Debug.Print(b.ToString());//true
b = regex.IsMatch("IV65537");
Debug.Print(b.ToString());//false
b = regex.IsMatch("IV65536");
Debug.Print(b.ToString());//true
any tips appreciated
i suppose i could parse the incoming string and separate the alpha and
numeric parts
but with regex that shouldn't be necessary, right?
thanks
mark