优化:改进IPv6正则表达式(避免`{{IPV6}}`替换为空)
This commit is contained in:
parent
65581cf4dc
commit
29ca4d3300
|
@ -30,7 +30,7 @@ class NetworkWorker(context: Context, params: WorkerParameters) : CoroutineWorke
|
|||
|
||||
private val TAG: String = NetworkWorker::class.java.simpleName
|
||||
private val ipv4Pattern = Regex("^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$")
|
||||
private val ipv6Pattern = Regex("^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$")
|
||||
private val ipv6Pattern = Regex("^((?:[\\da-fA-F]{0,4}:[\\da-fA-F]{0,4}){2,7})(?:[/\\\\%](\\d{1,3}))?$")
|
||||
|
||||
override suspend fun doWork(): Result {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue