1
0
Fork 1

Linkify bitcoin and bitcoincash URIs

(cherry picked from commit 5835550f2bbad89b22884858e3fe1c9065bf54ec)
This commit is contained in:
Stephen Paul Weber 2024-11-09 14:37:06 -05:00 committed by Arne
parent 2669a43560
commit c9d6e7b64b
2 changed files with 14 additions and 0 deletions

View file

@ -132,6 +132,8 @@ public class MyLinkify {
Linkify.addLinks(body, Patterns.XMPP_PATTERN, "xmpp", XMPPURI_MATCH_FILTER, null);
Linkify.addLinks(body, Patterns.TEL_URI, "tel");
Linkify.addLinks(body, Patterns.SMS_URI, "sms");
Linkify.addLinks(body, Patterns.BITCOIN_URI, "bitcoin");
Linkify.addLinks(body, Patterns.BITCOINCASH_URI, "bitcoincash");
Linkify.addLinks(body, Patterns.AUTOLINK_WEB_URL, "http", WEBURL_MATCH_FILTER, WEBURL_TRANSFORM_FILTER);
if (includeGeo) {
Linkify.addLinks(body, GeoHelper.GEO_URI, "geo");

View file

@ -33,6 +33,18 @@ public class Patterns {
+ "\\;\\/\\?\\@\\&\\=\\#\\~\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])"
+ "|(?:\\%[a-fA-F0-9]{2}))+");
public static final Pattern BITCOIN_URI = Pattern
.compile("bitcoin\\:(?:[13][a-km-zA-HJ-NP-Z1-9]{25,34}|[bB][cC]1[pPqQ][a-zA-Z0-9]{38,58})(?:\\?(?:(?:["
+ Patterns.GOOD_IRI_CHAR
+ "\\;\\/\\?\\@\\&\\=\\#\\~\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])"
+ "|(?:\\%[a-fA-F0-9]{2}))+)?");
public static final Pattern BITCOINCASH_URI = Pattern
.compile("bitcoincash\\:(?:[13][a-km-zA-HJ-NP-Z1-9]{33}|[qp][a-z0-9]{41})(?:\\?(?:(?:["
+ Patterns.GOOD_IRI_CHAR
+ "\\;\\/\\?\\@\\&\\=\\#\\~\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])"
+ "|(?:\\%[a-fA-F0-9]{2}))+)?");
/**
* Regular expression to match all IANA top-level domains.
* List accurate as of 2011/07/18. List taken from: