|
@@ -5,25 +5,26 @@ import com.alibaba.fastjson.JSON;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.UUID;
|
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
public class Test {
|
|
public class Test {
|
|
|
- public static void main(String[] args) throws Exception {
|
|
|
|
|
- List<String> listUrls = Arrays.asList("https://www.188420.com/", "https://www.188420.com/c/jdwx/", "https://www.188420.com/c/bgwx/", "https://www.188420.com/a/220124002203.html", "https://www.188420.com/a/211229000364.html", "https://www.188420.com/a/211229000358.html");
|
|
|
|
|
- listUrls = new ArrayList<>(listUrls);
|
|
|
|
|
-
|
|
|
|
|
- List<String> listPatterns = Arrays.asList("https://www.188420.com/a/([0-9]+).html", "https://www.188420.com/b/([a-zA-Z]+)/");
|
|
|
|
|
-
|
|
|
|
|
- listUrls.removeIf(s -> {
|
|
|
|
|
- boolean hasMatched = false;
|
|
|
|
|
- for (String regex : listPatterns) {
|
|
|
|
|
- hasMatched = Pattern.matches(regex, s);
|
|
|
|
|
- if (hasMatched) {
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return !hasMatched;
|
|
|
|
|
- });
|
|
|
|
|
- System.out.println(JSON.toJSONString(listUrls));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public static void main(String[] args) throws Exception {
|
|
|
|
|
+// List<String> listUrls = Arrays.asList("https://www.188420.com/", "https://www.188420.com/c/jdwx/", "https://www.188420.com/c/bgwx/", "https://www.188420.com/a/220124002203.html", "https://www.188420.com/a/211229000364.html", "https://www.188420.com/a/211229000358.html");
|
|
|
|
|
+// listUrls = new ArrayList<>(listUrls);
|
|
|
|
|
+//
|
|
|
|
|
+// List<String> listPatterns = Arrays.asList("https://www.188420.com/a/([0-9]+).html", "https://www.188420.com/b/([a-zA-Z]+)/");
|
|
|
|
|
+//
|
|
|
|
|
+// listUrls.removeIf(s -> {
|
|
|
|
|
+// boolean hasMatched = false;
|
|
|
|
|
+// for (String regex : listPatterns) {
|
|
|
|
|
+// hasMatched = Pattern.matches(regex, s);
|
|
|
|
|
+// if (hasMatched) {
|
|
|
|
|
+// break;
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// return !hasMatched;
|
|
|
|
|
+// });
|
|
|
|
|
+ System.out.println(UUID.randomUUID().toString());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|