Here is one example of use regexand javato solve your problem. I would suggest looking at some regular expression tutorial here - this is a nice option.
public static void main(String[] args) throws FileNotFoundException {
String test = "OBC9187A-1%A";
Pattern p = Pattern.compile("\\d.*\\d");
Matcher m = p.matcher(test);
while (m.find()) {
System.out.println("Match: " + m.group());
}
}
Conclusion:
Match: 9187A-1
\d .* - 0 \d . , \\d, , \ java, \ ... , -, . , / / , , . while , , . 1 , while if :
if(m.find())
{
System.out.println("Match: " + m.group());
}