|
Sub 提取()
Set reg = CreateObject("vbscript.regexp")
reg.ignorecase = True
With Sheets(1)
k = .Cells(65536, 2).End(xlUp).Row
.Cells(1, 3).Resize(k, 2).ClearContents
For i = 1 To k
reg.Pattern = ".*?(^|/)([一-龥]{4,}(?!\d+MHz)([a-z\d-]{4,})|([^/]*°[^/]*))(?=/|$).*"
If reg.test(Trim(.Cells(i, 2))) Then
.Cells(i, 4) = reg.Replace(Trim(.Cells(i, 2)), "$3$4")
Else
reg.Pattern = ".*?(^|/)(([.\d]+([unp]f|r)?)(?=[±/]).*?(/\d+m?[va])|(?=[^\(/]*\d)([a-z][^/\(]*\-.+?|[\w.]+)(?=[±/\(]|$)).*"
.Cells(i, 4) = "'" & reg.Replace(Trim(.Cells(i, 2)), "$3$5$6")
End If
.Cells(i, 3) = "'" & Split(.Cells(i, 4), "/")(0)
Next i
End With
End Sub |
|