mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-04-21 12:12:38 +02:00
Rewrote ClipboardUtils regex (#1361)
Co-authored-by: cyian-1756 <devnull64@vfemail.net>
This commit is contained in:
parent
4eaaabfff8
commit
013da3452c
@ -57,18 +57,7 @@ class AutoripThread extends Thread {
|
||||
// Check clipboard
|
||||
String clipboard = ClipboardUtils.getClipboardString();
|
||||
if (clipboard != null) {
|
||||
Pattern p = Pattern.compile(
|
||||
// TODO: This regex is a monster and doesn't match all links; It needs to be rewritten
|
||||
"\\b(((ht|f)tp(s?)://|~/|/)|www.)" +
|
||||
"(\\w+:\\w+@)?(([-\\w]+\\.)+(com|org|net|gov" +
|
||||
"|mil|biz|info|mobi|name|aero|jobs|museum" +
|
||||
"|travel|cafe|[a-z]{2}))(:[\\d]{1,5})?" +
|
||||
"(((/([-\\w~!$+|.,=]|%[a-f\\d]{2})+)+|/)+|\\?|#)?" +
|
||||
"((\\?([-\\w~!$+|.,*:]|%[a-f\\d{2}])+=?" +
|
||||
"([-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)" +
|
||||
"(&(?:[-\\w~!$+|.,*:]|%[a-f\\d{2}])+=?" +
|
||||
"([-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)*)*" +
|
||||
"(#([-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)?\\b");
|
||||
Pattern p = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]");
|
||||
Matcher m = p.matcher(clipboard);
|
||||
while (m.find()) {
|
||||
String url = m.group();
|
||||
|
Loading…
x
Reference in New Issue
Block a user