Hi I am trying to build one regex to extract 4 digit number from given string using java. I tried it in following ways:
String mydata = \"get the 0025 data f
Change you pattern to:
Pattern pattern = Pattern.compile("(\\d{4})");
\d is for a digit and the number in {} is the number of digits you want to have.
\d
{}