工作Android上的OCR项目,在一个条件扫描文本格式 出字符串后的从单个字符串中提取传真号码或电话号码?
Tel:+91 345677890 Fax: +91 80 222767000
中需要提取唯一的电话号码和传真号码。
在第二个例子
[email protected] ,Fax:+91 80 222767000
我需要在两个传真,电话和电子邮件分隔成一个变量
这篇但无法找到解决方案
String cellfound="Tel:+91 345677890 Fax: +91 80 222767000 [email protected]";
Pattern cellp1= Pattern.compile(".*\\b(Mobile|M|M)\\b.*",Pattern.CASE_INSENSITIVE);
Matcher cellm1 = cellp1.matcher(cellnumber);
if (cellm1.matches()) {
cellfound=cellm1.group();
System.out.println("\nbefore cell found "+cellfound);
cellfound=cellfound.replaceAll("[^0-9]", " ");
System.out.println("\nfinal cell found from pattern :"+cellfound);
}
使用String.subString()方法来单独数据 –
听起来像是正则表达式的工作。 – Biffen
使用正则表达式作为电话号码应该是一个正则表达式。 – Antoniossss