2015-07-09 43 views
0

这是可能的,e.g:如何识别主导电子邮件模式列表中的

[email protected] 
[email protected] 
[email protected] 
[email protected] 
[email protected] 

高于例如一个域名 的电子邮件ID主宰的模式是first.last名称。

用excel或其他方式从电子邮件列表中识别主导模式有什么方法吗? 这只是一个公司abc

如果有10个域分别包含5封电子邮件,那么我应该能够从这些电子邮件中找到5个主要格式。

想知道是否有人可以帮助我从我的搜索开始,并找到一种方法来实现自动化。

+0

用正则表达式跳转是一种错误的方法。首先定义具有可量化属性的“支配模式”,然后写出一个问题来提取和比较不同电子邮件之间的属性。 – nhahtdh

回答

0

看来,如果您使用正则表达式来分类字符串。这使用正则表达式在@符号前面匹配包含文字点(。)的表达式。我修改了一些来自tutorialspoint的代码以适应电子邮件模式。

import java.util.regex.Matcher; 
import java.util.regex.Pattern; 
public class RegexMatches { 
    public static void main(String args[]){ 

      // String to be scanned to find the pattern. 
      String[] emails = {"[email protected]", "[email protected]"}; 
      String pattern = "\\w+[.]\\w+([email protected])"; 

      // Create a Pattern object 
      Pattern r = Pattern.compile(pattern); 


    for (int i=0; i<emails.length; i++) { 
    // Now create matcher object. 
    String line = emails[i]; 
    System.out.println(line); 
      Matcher m = r.matcher(line); 
      if (m.find()) { 
      System.out.println("MATCH"); 
      } else { 
      System.out.println("NO MATCH"); 
      } 
    } 
     } 
    } 
+0

谢谢,请试试看。 –

相关问题