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
You can go with \d{4} or [0-9]{4} but note that by specifying the ^ at the beginning of regex and $ at the end you're limiting yourself to strings that contain only 4 digits.
\d{4}
[0-9]{4}
^
$
My recomendation: Learn some regex basics.