Hi,
I'm new with regex and i wanted to ask how to properly validate a string using regex?
I created a small demo here:
GeSHi (java):
class RegexString {
public static void main
(String[] args
){ Pattern p = Pattern.compile(re1,Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
Matcher m = p.matcher(txt);
if (m.find()){
System.
out.
print("String: "+text.
toString());
}
else{
}
}
}
Created by GeSHI 1.0.7.20
Although it prints out the text i can't seem to "catch" a non string value and do something with it. How can i go to the else when the entered text in the txt string does not matches [a-zA-Z] ?
Thanks,
Ark