String aStr="TEST-1-TV_50";
System.out.println(aStr.matches("^[A-Z0-9\\-\\_]+")); //TRUE.
But why this is not working..?
String aStr1= "$local:TEST12-1-TV_50 as xs:boolean";
int strtIndex=aStr.indexOf(":");
int endIndex=aStr.indexOf("as");
String extractedStr=aStr1.substring(strtIndex+1,endIndex); //TEST12-1-TV_50
System.out.println(extractedStr.matches("^[A-Z0-9\\-\\_]+")); //FALSE.
Why its giving result as false.???