Import org.apache.oro.text.regex.patternmatcher;
Import Org.Apache.oro.text.Regex.perl5matcher;
Import org.apache.oro.text.regex.patterncompiler;
Import Org.Apache.oro.text.Regex.perl5compiler;
Import Org.Apache.oro.text.Regex.pattern;
Public static boolean isvalidagesegment (string agesegment) {
String s = "[0-9] {2} [# ] [0-9] {2}";
Patternmatcher matcher = new perl5matcher ();
PatternCompiler Compiler = new perl5compiler ();
Try {
Pattern Pattern = compiler.compile (s);
Return matcher.matches (agsegment, pattern);
}
Catch (MalformedPatterNexception EX) {
Log.Error (ex);
Return False;
}
}