Sub supNcbi(ByVal control As IRibbonControl)
Call layout_search_replace.jump_to_reference_section
With selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Font.Italic = False
.Text = "^13[A-Z]*[A-Z]\. [A-Z][a-z]"
.MatchWildcards = True
.Replacement.Text = ""
.Wrap = wdFindStop
Do
.Execute
If Not .Found Then
Exit Do
End If
If .Found Then
Dim aimt As String
aimt = selection.Range.Text
If existCrlf(aimt) = False And IsNCBI(aimt) = False And IsNCBI1(aimt) = False And IsNCBI2(aimt) = False Then
Dim myrange As Range
Set myrange = selection.Range
myrange.Select
myrange.SetRange selection.Range.Start + 1, selection.Range.End - 3
myrange.Select
If InputBox("Is this ncbi?", "NCBI", "yes", 300, 300) = "yes" Then
MsgBox Len(aimt)
Call kr_deck.kr_ncbi
selection.collapse IIf(selection.Next(wdCharacter, 1) = ";", wdCollapseEnd, wdCollapseStart)
Else
selection.collapse wdCollapseEnd
End If
selection.collapse wdCollapseEnd
Else
End If
End If
Loop
End With
End Sub
Function IsNCBI(str As String) As Boolean
Dim reg As Object
Set reg = CreateObject("VBScript.Regexp")
Dim is_exist As Boolean
With reg
.Global = True
.Pattern = "[A-Z][a-z]\, [A-Z][a-z]"
is_exist = .test(str)
End With
IsNCBI = is_exist
End Function
Function IsNCBI1(str As String) As Boolean
Dim reg As Object
Set reg = CreateObject("VBScript.Regexp")
Dim is_exist As Boolean
With reg
.Global = True
.Pattern = "[^A-Za-z\.]\, [A-Z]"
is_exist = .test(str)
End With
IsNCBI1 = is_exist
End Function
Function IsNCBI2(str As String) As Boolean
Dim reg As Object
Set reg = CreateObject("VBScript.Regexp")
Dim is_exist As Boolean
With reg
.Global = True
.Pattern = "\;"
is_exist = .test(str)
End With
IsNCBI2 = is_exist
End Function