Android URL to determine regular expression modification

Source: Internet
Author: User

1. Add in Alps/frameworks/base/core/java/android/util/patterns.java
public static final String Top_level_domain_str_for_web_url_expand =
"(?:"
+ "(?: Aero|arpa|asia|a[cdefgilmnoqrstuwxz])"
+ "| (?: Biz|b[abdefghijmnorstvwyz]) "
+ "| (?: cat|com|coop|c[acdfghiklmnoruvxyz]) "
+ "|d[ejkmoz]"
+ "| (?: Edu|e[cegrstu]) "
+ "|f[ijkmor]"
+ "| (?: Gov|g[abdefghilmnpqrstuwy]) "
+ "|h[kmnrtu]"
+ "| (?: Inc|info|int|i[delmnoqrst]) "
+ "| (?: Jobs|j[emop]) "
+ "|k[eghimnprwyz]"
+ "|l[abcikrstuvy]"
+ "| (?: mil|mobi|museum|m[acdeghklmnopqrstuvwxyz]) "
+ "| (?: Name|net|n[acefgilopruz]) "
+ "| (?: O Rg|om) "
+ "| (?:p Ro|p[aefghklmnrstwy]) "
+ "|qa"
+ "|R[EOSUW]"
+ "|s[abcdeghijklmnortuvyz]"
+ "| (?: Tel|travel|t[cdfghjklmnoprtvwz]) "
+ "|u[agksyz]"
+ "|v[aceginu]"
+ "|w[fs]"
+ "| (?:\ u03b4\u03bf\u03ba\u03b9\u03bc\u03ae|\u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435 "
+ "|\u0440\u0444|\u0441\u0440\u0431|\u05d8\u05e2\u05e1\u05d8|\u0622\u0632\u0645\u0627\u06cc\u0634\u06cc"
+ "|\u0625\u062e\u062a\u0628\u0627\u0631|\u0627\u0644\u0627\u0631\u062f\u0646"
+ "|\u0627\u0644\u062c\u0632\u0627\u0626\u0631|\u0627\u0644\u0633\u0639\u0648\u062f\u064a\u0629"
+ "|\u0627\u0644\u0645\u063a\u0631\u0628|\u0627\u0645\u0627\u0631\u0627\u062a|\u0628\u06be\u0627\u0631\u062a"
+ "|\u062a\u0648\u0646\u0633|\u0633\u0648\u0631\u064a\u0629|\u0641\u0644\u0633\u0637\u064a\u0646"
+ "|\u0642\u0637\u0631|\u0645\u0635\u0631|\u092a\u0930\u0940\u0915\u094d\u0937\u093e"
+ "|\U092D\U093E\U0930\U0924|\U09AD\U09BE\U09B0\U09A4|\U0A2D\U0A3E\U0A30\U0A24|\U0AAD\U0ABE\U0AB0\U0AA4"
+ "|\u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe|\u0b87\u0bb2\u0b99\u0bcd\u0b95\u0bc8"
+ "|\U0B9A\U0BBF\U0B99\U0BCD\U0B95\U0BAA\U0BCD\U0BAA\U0BC2\U0BB0\U0BCD"
+ "|\U0BAA\U0BB0\U0BBF\U0B9F\U0BCD\U0B9A\U0BC8|\U0C2D\U0C3E\U0C30\U0C24\U0C4D|\U0DBD\U0D82\U0D9A\U0DCF"
+ "|\u0e44\u0e17\u0e22|\u30c6\u30b9\u30c8|\u4e2d\u56fd|\u4e2d\u570b|\u53f0\u6e7e|\u53f0\u7063"
+ "|\U65B0\U52A0\U5761|\U6D4B\U8BD5|\U6E2C\U8A66|\U9999\U6E2F|\UD14C\UC2A4\UD2B8|\UD55C\UAD6D"
+ "|xn\\-\\-0zwm56d|xn\\-\\-11b5bs3a9aj6g|xn\\-\\-3e0b707e|xn\\-\\-45brj9c|xn\\-\\-80akhbyknj4f"
+ "|xn\\-\\-90a3ac|xn\\-\\-9t4b11yi5a|xn\\-\\-clchc0ea0b2g2a9gcd|xn\\-\\-deba0ad|xn\\-\\-fiqs8s"
+ "|xn\\-\\-fiqz9s|xn\\-\\-fpcrj9c3d|xn\\-\\-fzc2c9e2c|xn\\-\\-g6w251d|xn\\-\\-gecrj9c|xn\\-\\-h2brj9c"
+ "|xn\\-\\-hgbk6aj7f53bba|xn\\-\\-hlcj6aya9esc7a|xn\\-\\-j6w193g|xn\\-\\-jxalpdlp|xn\\-\\-kgbechtv"
+ "|xn\\-\\-kprw13d|xn\\-\\-kpry57d|xn\\-\\-lgbbat1ad8j|xn\\-\\-mgbaam7a8h|xn\\-\\-mgbayh7gpa"
+ "|XN\\-\\-MGBBH1A71E|XN\\-\\-MGBC0A9AZCG|XN\\-\\-MGBERP4A5D4AR|XN\\-\\-O3CW4H|XN\\-\\-OGBPF8FL"
+ "|XN\\-\\-P1AI|XN\\-\\-PGBS0DH|XN\\-\\-S9BRJ9C|XN\\-\\-WGBH1C|XN\\-\\-WGBL6A|XN\\-\\-XKC2AL3HYE2A"
+ "|xn\\-\\-xkc2dl3a5ee0h|xn\\-\\-yfro4i67o|xn\\-\\-ygbi2ammx|xn\\-\\-zckzah|xxx)"
+ "|y[et]"
+ "|Z[AMW])";
2. Put the Alps/frameworks/base/core/java/android/util/patterns.java in the
public static final Pattern Web_url = Pattern.compile (
"((?:( http|https| http| https|rtsp| RTSP): \\/\\/(?:(?: [a-za-z0-9\\$\\-\\_\\.\\+\\!\\*\\ ' \ \ \) '
+ "\\,\\;\\?\\&\\=]| (?:\ \%[A-FA-F0-9]{2})) {1,64} (?: \ \:(?: [A-za-z0-9\\$\\-\\_]
+ "\\.\\+\\!\\*\\" \ \ \ \\,\\;\\?\\&\\=]| (?:\ \%[A-FA-F0-9]{2})) {1,25})? \\@)? "
+ "(?:" + domain_name + ")"
+ "(?:\ \:\\d{1,5}) " Plus option port number
+ "(\\/(?:(?: [" + Good_iri_char + "\\;\\/\\?\\:\\@\\&\\=\\#\\~"//Plus option query params
+ "\\-\\.\\+\\!\\*\\" \ \ \ \\,\\_]) | (?:\ \%[A-FA-F0-9]{2}))? "
+ "(?:\ \b|$) "); And finally, a word boundary or end of
Input. This was to the stop Foo.sure from
Matching as Foo.su
Replace with:
public static final Pattern Web_url = pattern
. Compile ("(?:( http|https| http| https|rtsp| RTSP): \\/\\/(?:(?: [a-za-z0-9\\$\\-\\_\\.\\+\\!\\*\\ ' \ \ \) '
+ "\\,\\;\\?\\&\\=]| (?:\ \%[A-FA-F0-9]{2})) {1,64} (?: \ \:(?: [A-za-z0-9\\$\\-\\_]
+ "\\.\\+\\!\\*\\" \ \ \ \\,\\;\\?\\&\\=]| (?:\ \%[A-FA-F0-9]{2})) {1,25})? \\@)? "
+ "((?:(?:["
+ Eng_iri_char
+ "]["
+ Good_iri_char
+ "\\-]{0,64}\\.") +"
+ Top_level_domain_str_for_web_url_expand
+ "| (?:(? : 25[0-5]|2[0-4] "
+ "[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}) "
+ "(\\/(?:(?:["
+ Goodirichar
+ "\\;\\/\\?\\:\\@\\&\\=\\#\\~"
+ "\\-\\.\\+\\!\\*\\" \ \ \ \\,\\_]) | (?:\ \%[A-FA-F0-9]{2}))? "
+ "(?:\ \b|$) ");

Android URL to determine regular expression modification

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.