|
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
Select Case i
Case Is < 183
reg.Pattern = "^\s*.*?([^/]*?°[^/]*).*|^[一-龡]+/([^/]+/)?([\.\d]+([m-z][hf])?)/.*"
If reg.test(.Cells(i, 2)) Then
.Cells(i, 3) = "'" & reg.Replace(.Cells(i, 2), "$1$3")
Else
reg.Pattern = "^\s*.*?((?=[^/]*?[a-z])([^\(/一-龡]*\d+[^\(/一-龡]*)+).*"
.Cells(i, 3) = reg.Replace(.Cells(i, 2), "$1")
End If
Case Else
reg.Pattern = ".*?(\d+[a-z]?[rf]).*?(/\d+[a-z]?[av]).*"
.Cells(i, 4) = reg.Replace(.Cells(i, 2), "$1$2")
.Cells(i, 3) = Split(.Cells(i, 4), "/")(0)
End Select
Next i
End With
End Sub
|
|