How can I parse such data with Java regex?
data.param[0]
0 - is any non negavite digit
Here is my try -
String result = Pattern.compile("(data.param[)(\\d+)(])").matcher("data.param[13123]").group();
You can use this regex:
Pattern p = Pattern.compile("data\\.param\\[(\\d+)\\]");
Matcher m = p.matcher("data.param[13123]");
if (m.find())
System.out.println(m.group(1));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.