博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
android 短信正则表达式错误
阅读量:4043 次
发布时间:2019-05-24

本文共 994 字,大约阅读时间需要 3 分钟。

前后都有中文的情况下如何正确提取URL
 
请帮忙做如下修改
mediatek\frameworks\base\op\java\com\mediatek\op\util\DefaultPatterns.java
public static Pattern getWebUrl(final String engIriChar, final String goodIriChar,
            final String topLevelDomainStrForWebUrlExpand) {
            return  Pattern.compile(
                    "((?:(http|https|Http|Https|rtsp|Rtsp):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)"
                    + "_"
                    + "@)?)?"
                    + "((?:(?:[" + engIriChar + "][" + engIriChar + ".)+"   // named host
                    + topLevelDomainStrForWebUrlExpand
                    + "|(?:(?:25[0-5]|2[0-4]" // or ip address
                    + "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(?:25[0-5]|2[0-4][0-9]"
                    + "|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1]"
                    + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}"
                    + "|[1-9][0-9]|[0-9])))"
                    + "(?:\\:\\d{1,5})?)" // plus option port number
                    + "(\\/(?:(?:[" + goodIriChar + "~"  // plus option query params
                    + "}))*)?"
                    + "(?:\\b|$)"); // and finally, a word boundary or end of
                                    // input.  This is to stop foo.sure from
                                    // matching as foo.su
    }

转载地址:http://ycedi.baihongyu.com/

你可能感兴趣的文章
Jenkins + Docker + SpringCloud 微服务持续集成 - 高可用集群部署(三)
查看>>
Golang struct 指针引用用法(声明入门篇)
查看>>
Linux 粘滞位 suid sgid
查看>>
C#控件集DotNetBar安装及破解
查看>>
Winform皮肤控件IrisSkin4.dll使用
查看>>
Winform多线程
查看>>
C# 托管与非托管
查看>>
CheckListBox用法详解
查看>>
帮助文档(*.chm)制作 以及在winform程序中的应用
查看>>
字节序(byte order)及其实现方法
查看>>
C# 重写WndProc 拦截 发送 系统消息
查看>>
C#接口详解
查看>>
C#多态性详解
查看>>
LabVIEW OOP基础
查看>>
JS高阶知识点
查看>>
前端经典面试题(持续更新)
查看>>
Markdown编辑器基本语法
查看>>
深入理解计算机系统(读书笔记)
查看>>
Markdown编辑公式和CSDN-Markdown编辑公式
查看>>
计算机网络(读书笔记)
查看>>