diff --git a/Java/Regex.java b/Java/Regex.java index 6bc2adf..88701bb 100644 --- a/Java/Regex.java +++ b/Java/Regex.java @@ -5,3 +5,15 @@ public static boolean isIp(String ip) { return ip != null && !ip.equals("") && ip.matches("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"); } + + +public static void extractFromRegex(String str) { + Pattern pattern = Pattern.compile(".*@(.*)"); + Matcher matcher = pattern.matcher(str); + + while (matcher.find()) { + if (matcher.groupCount() == 1) { + System.out.println("domaine: "+matcher.group(1)); + } + } +} \ No newline at end of file