Hi there, please can some help with this very simple regex. I am coming from c# and trying to get up to speed quickly, so have been trying to create samples for my refrence, however can not get this to work
String aString = "0123";
Pattern intPattern = Pattern.compile("^[0-9]{3}");
Matcher strMatch = intPattern.matcher(aString);
if(strMatch.find())
{
System.out.println("Match");
}
For the patern I have try:
("^[0-9]$") fails
("[0-9]") fails, as if input has a no numeric character a match is still reported (as expected)
("^[0-9]\\z")fails
("\\d") fails as ("[0-9]")
("^\\d$") fails
Please please can anyone tell me what stupid mistake I am making, thank you.