mirror of
https://github.com/pppscn/SmsForwarder
synced 2025-08-02 17:07:41 +08:00
优化:URL正则表达式支持 HTTP Basic Authentication #170
This commit is contained in:
parent
a5a1a62873
commit
bb4e44c419
@ -243,7 +243,7 @@ class CommonUtils private constructor() {
|
||||
//是否合法的url
|
||||
fun checkUrl(urls: String?, emptyResult: Boolean): Boolean {
|
||||
if (TextUtils.isEmpty(urls)) return emptyResult
|
||||
val regex = "(ht|f)tp(s?)\\:\\/\\/[\\da-zA-Z]([-.\\w]*[\\da-zA-Z])*(:(0-9)*)*(\\/?)([a-zA-Z\\d\\-\\.\\?\\,\\'\\/\\\\&%\\+\\$#_=]*)?"
|
||||
val regex = "^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"
|
||||
val pat = Pattern.compile(regex)
|
||||
val mat = pat.matcher(urls?.trim() ?: "")
|
||||
return mat.matches()
|
||||
|
Loading…
x
Reference in New Issue
Block a user