用正規表示式匹配電話號碼

2021-07-26 06:33:58 字數 2437 閱讀 7515

在hive中,使用正規表示式來篩選**號碼,**號碼不像手機號一樣,**比較難匹配,需要考慮的情況也比較多,所以在這裡我使用正規表示式匹配所有的**號碼,比較長,只要用耐心就比較好整理。

號碼由數字或『-』組成,位數在10到12位之間,其中區號3-4位,號碼7-8位

length(regexp_replace(receiver,'-',''))<=12

and

(substr(receiver,1,3)='010'

orsubstr(receiver,1,3) rlike '^02[0-57-9].*$'

orsubstr(receiver,1,4) rlike '^031[0-9].*$'

orsubstr(receiver,1,4) rlike '^0335.*$'

orsubstr(receiver,1,4) rlike '^0349.*$'

orsubstr(receiver,1,4) rlike '^035[1-9].*$'

orsubstr(receiver,1,4) rlike '^037[0-79].*$'

orsubstr(receiver,1,4) rlike '^039[1-8].*$'

orsubstr(receiver,1,4) rlike '^041[125-9].*$'

orsubstr(receiver,1,4) rlike '^042[179].*$'

orsubstr(receiver,1,4) rlike '^04[35][1-9].*$'

orsubstr(receiver,1,4) rlike '^046[4789].*$'

orsubstr(receiver,1,4) rlike '^047[0-9].*$'

orsubstr(receiver,1,4) rlike '^048[23].*$'

orsubstr(receiver,1,4) rlike '^052[37].*$'

orsubstr(receiver,1,4) rlike '^053[0-9].*$'

orsubstr(receiver,1,4) rlike '^054[36].*$'

orsubstr(receiver,1,4) rlike '^055[0-9].*$'

orsubstr(receiver,1,4) rlike '^056[1-46].*$'

orsubstr(receiver,1,4) rlike '^057[0-9].*$'

orsubstr(receiver,1,4) rlike '^0580.*$'

orsubstr(receiver,1,4) rlike '^063[1-5].*$'

orsubstr(receiver,1,4) rlike '^066[0238].*$'

orsubstr(receiver,1,4) rlike '^069[12].*$'

orsubstr(receiver,1,4) rlike '^0701.*$'

orsubstr(receiver,1,4) rlike '^07[1579][0-9].*$'

orsubstr(receiver,1,4) rlike '^072[248].*$'

orsubstr(receiver,1,4) rlike '^073[014-9].*$'

orsubstr(receiver,1,4) rlike '^074[3-6].*$'

orsubstr(receiver,1,4) rlike '^076[023689].*$'

orsubstr(receiver,1,4) rlike '^081[23678].*$'

orsubstr(receiver,1,4) rlike '^082[567].*$'

orsubstr(receiver,1,4) rlike '^08[37][0-9].*$'

orsubstr(receiver,1,4) rlike '^085[14-9].*$'

orsubstr(receiver,1,4) rlike '^088[3678].*$'

orsubstr(receiver,1,4) rlike '^089[1-8].*$'

orsubstr(receiver,1,4) rlike '^090[123689].*$'

orsubstr(receiver,1,4) rlike '^091[12345679].*$'

orsubstr(receiver,1,4) rlike '^09[39][0-9].*$'

orsubstr(receiver,1,4) rlike '^094[13].*$'

orsubstr(receiver,1,4) rlike '^095[12345].*$'

orsubstr(receiver,1,4) rlike '^097[012345679].*$'

)

電話號碼正規表示式

在做專案時常常用到判斷 號碼的正規表示式,寫了乙個,可驗證如下27種格式 1108888888 88888888 8888888 123 88888888 23435 0871 8888888 123 023 88888888 23435 86 0871 8888888 123 8888888 12...

電話號碼正規表示式

d d d d d d d d d d d d d d d d d 匹配格式 11位手機號碼 3 4位區號,7 8位直播號碼,1 4位分機號 如 12345678901 1234 12345678 1234 d 非負整數 正整數 0 0 9 1 9 0 9 正整數 d 0 非正整數 負整數 0 0 ...

電話號碼正規表示式

號碼正規表示式 支援手機號碼,3 4位區號,7 8位直播號碼,1 4位分機號 d d d d d d d d d d d d d d d d d 匹配格式 11位手機號碼 3 4位區號,7 8位直播號碼,1 4位分機號 如 12345678901 1234 12345678 1234 匹配中文字元的...