/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
"This is the text to be searched " +
"for occurrences of the http:// pattern. Find http:// again";
String patternString
= ".*http://.*";
Pattern pattern = Pattern.compile(patternString);
Matcher matcher = pattern.matcher(text);
System.
out.
println(matcher.
matches());
String patternString2
= "http://";
Pattern pattern2 = Pattern.compile(patternString2);
Matcher matcher2 = pattern2.matcher(text);
System.
out.
println(matcher2.
matches()); System.
out.
println(matcher2.
find()); System.
out.
println(matcher2.
find()); System.
out.
println(matcher2.
find()); }
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwucmVnZXguTWF0Y2hlcjsKaW1wb3J0IGphdmEudXRpbC5yZWdleC5QYXR0ZXJuOwoKLyogTmFtZSBvZiB0aGUgY2xhc3MgaGFzIHRvIGJlICJNYWluIiBvbmx5IGlmIHRoZSBjbGFzcyBpcyBwdWJsaWMuICovCmNsYXNzIElkZW9uZQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlTdHJpbmcgdGV4dCA9CgkJCSJUaGlzIGlzIHRoZSB0ZXh0IHRvIGJlIHNlYXJjaGVkICIgKwoJCQkJImZvciBvY2N1cnJlbmNlcyBvZiB0aGUgaHR0cDovLyBwYXR0ZXJuLiBGaW5kIGh0dHA6Ly8gYWdhaW4iOwoKCQlTdHJpbmcgcGF0dGVyblN0cmluZyA9ICIuKmh0dHA6Ly8uKiI7CgoJCVBhdHRlcm4gcGF0dGVybiA9IFBhdHRlcm4uY29tcGlsZShwYXR0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