[英]How can I find all matches to a regular expression in android
如何找到android中正則表達式的所有匹配項。 我發現它適用於Perl,Python等,但不適用於Android。
這是一個例子:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
...
// Find all the words of "foo bar".
Matcher m = Pattern.compile("\\w+").matcher("foo bar");
while (m.find()) {
System.out.println("Found: " + m.group(0));
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.