Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
391 views
in Technique[技术] by (71.8m points)

java - How can I find all matches to a regular expression in android

How can I find all matches to a regular expression in android. I founds it for Perl, Python etc but not for android.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Here's an example:

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));
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...