In my Android application I get a response from a server in HTML format, which contains the value of the current volume of the device.
I’m trying to match numbers of volume using RegexAPI but it returns me an empty (“”) String, here is the code:
Matcher m = Pattern.compile("\\d*").matcher(response);
m.find();
String volume = m.group();
Where the response is: <html><li>100</html>
What am I doing wrong?
You need to use
"\\d+".Using
\d*says match 0 or more digits, so""matches that regex.Using the
+says match 1 or more digits.