工作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