Sub extract_1()
'Selection.MoveDown unit:=wdParagraph, Extend:=wdExtend
a = Split(Selection.Paragraphs(1).Range.Text, Chr(13))(0)
a = reg_arr("\[\[(.*?)\]\]", a)
str1 = ""
For i = 1 To UBound(a)
str1 = str1 & a(i)
If Right(a(i), 1) = "。" Or Right(a(i), 1) = "!" Then
str1 = str1
Else
str1 = str1 & "。"
End If
Next
Selection.Paragraphs(1).Range.Select
'Selection.Delete
Selection.TypeText Text:=str1
'---
If MsgBox("next?", vbOKCancel) = vbOK Then
Selection.MoveDown unit:=wdParagraph
If judge_pa Then
extract_1
Else
For i = 1 To 15
Selection.MoveDown unit:=wdParagraph
If judge_pa Then
extract_1
Exit For
End If
Next
End If
End If
End Sub
Function judge_pa()
a = Split(Selection.Paragraphs(1).Range.Text, Chr(13))(0)
If a = "" Then
judge_pa = False
Else
judge_pa = True
End If
End Function
Function reg_arr(reg_1, str_1)
'获得的arr,从序号1开始取(即第2个),因0的位置(即第一个)为空
Dim y
str_spt = "@-@"
Set Regex2 = CreateObject("vbscript.regexp")
With Regex2
.Global = True
.IgnoreCase = True
.Pattern = reg_1
Set matches2 = Regex2.Execute(str_1)
' reg_arr = matches2(0).submatches(0)
For Each m In matches2
y = y & str_spt & m.submatches(0)
Next
reg_arr = Split(y, str_spt)
End With
Set Regex2 = Nothing
Set matches2 = Nothing
End Function