How to get a matched String?# Java - 爪哇娇娃
g*g
1 楼
If you have a long text, you want to use regex to match it and
get back the first matched String, is this what I should do?
String[] strs = text.split("regex", 2);
text.substring(strs[0].length, text.length - strs[1].length);
get back the first matched String, is this what I should do?
String[] strs = text.split("regex", 2);
text.substring(strs[0].length, text.length - strs[1].length);