I am making a simple regex to determine integers of length 1-4 from string my regex is:
\d{1,4}
My Regex is valid in all online regex testing sites such as regex101 but Android studio is not accepting this Regex please find image here.
I need your help in finding any silly mistakes in this. Sample:
Regex: \d{1,4}
String: dgsdfg700
Match: 700
Please tell where am I doing wrong so studio is not accepting my regex and all other sites are.
MY code:
Pattern pattern = Pattern.compile("\\d{1,4}");
Matcher matcher = pattern.matcher(mystring);
if (matcher.find())
{
//my stuff here
}