{"text_format":"1","workbook":"xlsx","n_sheets":2,"sheets":["InPut","Out"],"not_rendered":{"charts":0,"images":0,"macros":1,"external_links":0,"defined_names":0,"comments":0,"pivot_tables":0},"unopened":[],"bounds":{"document_bytes":16777216,"sheet_cells":100000,"rows_first":2000,"rows_last":500,"rows_between":2000,"halvings":0,"cell_chars":16384,"cell_head_chars":4096},"cells_cut":0,"cells_raw":0,"read":"whole","date_system":"1900"}

{"sheet":"InPut","index":0,"n_rows":476,"n_cols":1,"rows_kept":476,"cut":false,"hidden":false,"merged":[]}
["Function testNON() As Long"]
[" 'テスト用 引数なし、戻り値あり"]
["End Function"]
["Function abc()"]
[" 'テスト用 引数なし、戻り値なし"]
["End Function"]
["Function test(h1 As String)"]
[" 'テスト用 引数ひとつ、戻り値なし"]
["End Function"]
["Function testLong(h1 As String) _"]
["As Long"]
[" 'テスト用 引数ひとつ、戻り値ひとつ、途中改行あり"]
["End Function"]
["Function RExp_inStrComp(Text As String, format As String, pattern As Boolean) As Boolean"]
["    Dim RegExpObj As RegExp"]
["     "]
["    Set RegExpObj = CreateObject(\"VBScript.RegExp\")"]
["     "]
["    '全角/半角の区別 True(区別する)/False(区別しない)"]
["    RegExpObj.IgnoreCase = True"]
["    '適応個所 True(すべて)/False(一致する先頭の一つが対象)"]
["    RegExpObj.Global = True"]
["     "]
["    '探す文字列（検索フォーマット）"]
["    If pattern = True Then"]
["    '完全一致"]
["        RegExpObj.pattern = \"^\" & format & \"$\""]
["    Else"]
["        RegExpObj.pattern = format"]
["    End If"]
["     "]
["    '結果を返す"]
["    RExp_inStrComp = RegExpObj.test(Text)"]
["     "]
["    Set RegExpObj = Nothing"]
["    "]
["End Function"]
[]
[]
["' ********************************************************"]
["'  一致数を調べる正規表現文字列検索"]
["'  第1引数 text に 第2引数 formatと一致する回数を戻り値で返す"]
["'  formatは、正規表現で表す。(見つからない場合0が戻る)"]
["'  第3引数 posをオプションで追加。検索開始位置の指定"]
["' ********************************************************"]
["Function RExp_FindCount(ByRef Text As String, ByRef format As String, Optional pos As Long = 1) As Long"]
["     "]
["    Dim RegExpObj As RegExp"]
["    Dim findList As MatchCollection"]
["    Dim findItem As Match"]
["    Dim cnt As Long"]
["     "]
["    Set RegExpObj = CreateObject(\"VBScript.RegExp\")"]
["     "]
["    '正規表現検索の初期値設定"]
["    RegExpObj.IgnoreCase = True '全角半角区別"]
["    RegExpObj.Global = True     'すべて探す"]
["    RegExpObj.pattern = format  '見つけるフォーマット"]
["    "]
["    Set findList = RegExpObj.Execute(Right(Text, Len(Text) - (pos - 1)))"]
["     "]
["    RExp_FindCount = findList.Count"]
["    "]
["End Function"]
[]
[]
["' ********************************************************"]
["'  一致箇所をリストで求める正規表現文字列検索"]
["'  第1引数 textの文字列から第2引数 formatと一致する文字列リストを返す"]
["'  第2引数 format は、正規表現で表す。"]
["'  第3引数 returnlist() が配列で、一致文字列リストが返る"]
["'  見つかった数を戻り値で返す。(見つからない場合0が戻る)"]
["' ********************************************************"]
["Function RExp_FindStrArr(ByRef Text As String, ByRef format As String, _"]
["                    ByRef returnlist() As String) As Long"]
["     "]
["    Dim RegExpObj As RegExp"]
["    Dim findList As MatchCollection"]
["    Dim findItem As Match"]
["    Dim cnt As Long"]
["     "]
["    Set RegExpObj = CreateObject(\"VBScript.RegExp\")"]
["     "]
["    '正規表現検索の初期値設定"]
["    RegExpObj.IgnoreCase = True"]
["    RegExpObj.Global = True"]
["    RegExpObj.pattern = format"]
["     "]
["    'まずは、一致数を調べる"]
["    Set findList = RegExpObj.Execute(Text)"]
["    "]
["    If findList.Count = 0 Then"]
["        RExp_FindStrArr = 0"]
["        Exit Function"]
["    End If"]
["    "]
["    "]
["    '一致数 findList.Count数分の配列を準備"]
["    '配列の添え字を0番から使用するため、必要配列数は1を引く([0]から埋める)"]
["    ReDim returnlist(findList.Count - 1)"]
[" "]
["    '配列に格納する"]
["    cnt = 0"]
["    For Each findItem In findList"]
["        returnlist(cnt) = findItem.Value"]
["        cnt = cnt + 1"]
["    Next"]
["    '一致数を返す"]
["    RExp_FindStrArr = findList.Count"]
[" "]
["End Function"]
[]
["Function RExp_Replace(Text As String, format As String, chgtext As String, all_flg As Boolean) As String"]
[" "]
["    Dim RegExpObj As RegExp"]
["     "]
["    On Error GoTo FuncEnd"]
["    Set RegExpObj = CreateObject(\"VBScript.RegExp\")"]
["     "]
["    '全角/半角の区別"]
["    RegExpObj.IgnoreCase = True"]
["    '適応個所 (引数に従う)"]
["    RegExpObj.Global = all_flg"]
["    '適応個所 (引数に従う)"]
["    RegExpObj.pattern = format"]
["     "]
["    RExp_Replace = RegExpObj.Replace(Text, chgtext)"]
["   "]
["  Exit Function"]
["   "]
["FuncEnd:"]
["       "]
["      Debug.Print \"フォーマットを見直してください。正規表現の記号の使い方に問題がありそうです。\""]
["       "]
["End Function"]
[]
["'****************************************************"]
["' 一致開始箇所の文字位置を返す"]
["' 引数 pos : 検索開始位置"]
["' 引数 text：検索対象文字列"]
["' 引数 format : 正規表現検索文字列"]
["'****************************************************"]
["Function RExp_InStr(pos As Long, Text As String, format As String) As Long"]
["     "]
["    Dim temp As String"]
["     "]
["    '一致する文字列の先頭一か所を取得"]
["    temp = RExp_FindStr(pos, Text, format)"]
["     "]
["    If Not temp = \"\" Then"]
["        RExp_InStr = InStr(pos, Text, temp, vbTextCompare)"]
["    Else"]
["        RExp_InStr = 0"]
["    End If"]
[" "]
["End Function"]
[]
["'*****************************************************"]
["'一致する文字列の先頭(一つ目)の文字列を返す"]
["'引数 pos : 検索開始位置"]
["'引数 text : 検索対象文字列"]
["'引数 format : 正規表現検索文字列"]
["'*****************************************************"]
["Function RExp_FindStr(pos As Long, Text As String, format As String) As String"]
["    "]
["    Dim returnlist() As String"]
["    Dim getstr As String"]
["    "]
["    "]
["    If RExp_FindCount(Text, format, pos) > 0 Then"]
["    "]
["        getstr = Right(Text, Len(Text) - (pos - 1))"]
["        "]
["        Call RExp_FindStrArr(getstr, format, returnlist)"]
["        "]
["        RExp_FindStr = returnlist(0)"]
["        "]
["    Else"]
["        "]
["        RExp_FindStr = \"\""]
["    End If"]
["    "]
["End Function"]
[]
["' **********************************************"]
["'  正規表現の記号にエスケープ記号を付加する"]
["' **********************************************"]
["Function SetEscape(ByRef chgStr As String)"]
["     "]
["    chgStr = Replace(chgStr, \"\\\", \"\\\\\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"*\", \"\\*\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"+\", \"\\+\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \".\", \"\\.\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"?\", \"\\?\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"{\", \"\\{\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"}\", \"\\}\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"(\", \"\\(\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \")\", \"\\)\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"[\", \"\\[\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"]\", \"\\]\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"^\", \"\\^\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"$\", \"\\$\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"-\", \"\\-\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"|\", \"\\|\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"/\", \"\\/\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"\"\"\", \"\\\"\"\", , , vbBinaryCompare)"]
["     "]
["End Function"]
["                        "]
["                            oWSht.Cells(outRow, 3).Value = getText"]
["                            outRow = outRow + 1"]
["                            "]
["                        End If"]
["                        "]
["                        '読み終わった分を消去"]
["                        getText = Left(readStr, chkPt)"]
["                        readStr = Replace(readStr, getText, \"\", , 1, vbTextCompare)"]
["                        "]
["                        '次の読み出し"]
["                        chkPt = RExp_InStr(1, readStr, \"(,|$|\\)|\\n)\")"]
["                    Else"]
["                        chkPt = 0"]
["                    End If"]
["                    "]
["                Loop"]
["                "]
["            End If"]
["        End If"]
["   Next"]
["   "]
["       '前の関数に引数があった場合"]
["    If 引数StRow > 0 Then"]
["        引数EdRow = outRow - 1"]
["        If 引数StRow > 0 And 引数EdRow > 0 Then"]
["            oWSht.Rows(引数StRow & \":\" & 引数EdRow).Group"]
["        End If"]
["    End If"]
["   "]
["   Application.DisplayAlerts = False"]
["   inWSht.Delete"]
["   Application.DisplayAlerts = True"]
["   "]
["   Set inWSht = Nothing"]
["   Set Rng = Nothing"]
["    "]
["End Sub"]
[]
[]
[]
[]
[]
["Sub 検索リスト_フォント変更(WSht As Worksheet)"]
["    "]
["    Dim Rng As Range"]
["    Dim FindListRng As Range"]
["    Dim SetSht As Worksheet"]
["            "]
["    '検索ワードリストのあるシートオブジェクトを設定"]
["    Set SetSht = Worksheets(\"Setting\")"]
["    "]
["    'A列(使用中の列の左端の列)を取得"]
["    Set FindListRng = SetSht.Range(SetSht.UsedRange.Columns(1).Address)"]
["    "]
["    For Each Rng In FindListRng"]
["    '検索文字列リストでループ"]
["    "]
["        If Rng.Row > 1 And Not Rng.Value = \"\" Then"]
["        'ループ参照セルが2行目以降、かつ、検索文字列セルが空でなければ、"]
["                "]
["            If Rng.Offset(0, 1).Value = \"\" Then"]
["            '検索文字列の右隣セルに情報がない（正規表現指定なし）の場合"]
["                "]
["                If Rng.Offset(0, 2).Value = \"ON\" Then"]
["                '検索文字列の二つ右隣セル(単語検索)がONか確認する"]
["                "]
["                    '文字色を変更する関数の呼び出し"]
["                    '引数1 必須 対象シートオブジェクト"]
["                    '引数2 必須 検索文字列(セル情報)"]
["                    '引数3 Optional 正規表現検索 指定なしはOFF(False)"]
["                    '引数4 Optional 単語検索 ON(True)"]
["                    Call フォント変更(WSht, Rng, Word:=True)"]
["                                        "]
["                Else"]
["                    "]
["                    '文字色を変更する関数の呼び出し"]
["                    '引数1 必須 対象シートオブジェクト"]
["                    '引数2 必須 検索文字列(セル情報)"]
["                    '引数3 Optional 正規表現検索 指定なしはOFF(False)"]
["                    '引数4 Optional 単語検索 指定なしはOFF(False)"]
["                    Call フォント変更(WSht, Rng)"]
["                    "]
["                End If"]
["            "]
["            Else"]
["                '正規表現指定あり"]
["                "]
["                If Rng.Offset(0, 1).Value = \"ON\" Then"]
["                '正規表現指定がONの場合"]
["                    "]
["                    '文字色を変更する関数の呼び出し"]
["                    '引数1 必須 対象シートオブジェクト"]
["                    '引数2 必須 検索文字列(セル情報)"]
["                    '引数3 Optional 正規表現検索 ON(True)"]
["                    '引数4 Optional 単語検索 指定なしはOFF(False)"]
["                    Call フォント変更(WSht, Rng, True)"]
["                    "]
["                Else"]
["                '正規表現指定がOFFの場合"]
["                "]
["                    '文字色を変更する関数の呼び出し"]
["                    '引数1 必須 対象シートオブジェクト"]
["                    '引数2 必須 検索文字列(セル情報)"]
["                    '引数3 Optional 正規表現検索 指定無しはOFF(False)"]
["                    '引数4 Optional 単語検索 指定なしはOFF(False)"]
["                    Call フォント変更(WSht, Rng)"]
["                    "]
["                End If"]
["            End If"]
["        End If"]
["    Next"]
["    "]
["    Set Rng = Nothing"]
["    Set FindListRng = Nothing"]
["    Set SetSht = Nothing"]
[]
["End Sub"]
[]
["'*************************************************"]
["' フォント変更 該当箇所の文字色を変更する"]
["' 引数1 Wst      :変更対象のシートオブジェクト"]
["' 引数2 TextRng  :検索文字列と指定フォント"]
["' 引数3 Reg      :正規表現の有無(デフォルトは、無し)"]
["' 引数4 Word     :単語検索の有無(デフォルトは、無し)"]
["' ***********************************************"]
["Function フォント変更(Wst As Worksheet, TextRng As Range, _"]
["                      Optional Reg As Boolean = False, _"]
["                      Optional Word As Boolean = False) As Boolean"]
["    "]
["    'ループ用"]
["    Dim Rng As Range"]
["    '検索一致位置"]
["    Dim pos As Long"]
["    '検索して一致した文字列の長さ"]
["    Dim leng As Long"]
["    'セル内文章の検索開始位置"]
["    Dim stPos As Long"]
["    '正規表現検索で一致した文字列"]
["    Dim str As String"]
["    '検索文字列"]
["    Dim textStr As String"]
["    "]
["    If Word = True Then"]
["    '単語検索がONの場合、正規表現検索をする"]
["        "]
["        '引数の正規表現検索オプションをTrueに変更する"]
["        Reg = True"]
["        "]
["        '正規表現の書き方で(A|B|C|D|E)は、A Or B Or C Or D Or Eを意味する"]
["        '今回は、Aが空白文字(スペースやタブ、セル内改行)、"]
["        '　Bが行頭記号^、又は、行末記号$、"]
["        '　Cが開き括弧(、Dが閉じ括弧)、Eがイコール= として、検索文字列を挟む"]
["        '括弧は正規表現で意味のある特殊記号のため、括弧の検索のためには"]
["        'エスケープ記号\\を付加する"]
["        "]
["        '検索文字列を作成"]
["        textStr = \"(\\s|^|\\(|\\)|=)\" & TextRng.Value & \"(\\s|$|\\(|\\)|=)\""]
["           "]
["    Else"]
["    '単語検索がOFFの場合"]
["        "]
["        '検索文字列を設定"]
["        textStr = TextRng.Value"]
["    "]
["    End If"]
["        "]
["    '指定シートのすべての文章を対象としてループ"]
["    For Each Rng In Wst.UsedRange"]
["               "]
["        For stPos = 1 To Len(Rng.Text)"]
["        '文字列の先頭から終わりまで"]
["        '一つのセル内に検索一致箇所が複数存在する可能性があるため、一致した箇所の一つ後ろにstPosを移動させ、"]
["        '残り後ろの文章で再検索するためのループ（検索文字列を含む限りループし、含まなければループは抜ける）"]
["        "]
["            '正規表現検索なしの場合"]
["            If Reg = False Then"]
["                "]
["                '通常検索"]
["                pos = InStr(stPos, Rng.Value, textStr, vbTextCompare)"]
["                "]
["                '文字数を取得"]
["                leng = Len(textStr)"]
["                "]
["            Else"]
["                '正規表現検索"]
["                str = RExp_FindStr(stPos, Rng.Value, textStr)"]
["                "]
["                If str = \"\" Then"]
["                '見つからなかった場合"]
["                    pos = 0"]
["                "]
["                Else"]
["                '見つかった場合"]
["                "]
["                    If Word = True Then"]
["                    '単語検索の場合"]
["                                "]
["                        '正規表現検索で一致した文字列の位置を取得"]
["                        pos = InStr(stPos, Rng.Value, str, vbBinaryCompare)"]
[]
["                        '単語の位置の補正（単語前に記号がある場合、除外するため）"]
["                        pos = pos + InStr(1, str, TextRng.Value, vbTextCompare) - 1"]
["                        '文字数を取得"]
["                        leng = Len(TextRng.Value)"]
["                    Else"]
["                    '正規表現検索"]
["                        "]
["                        '正規表現検索で一致した文字列の位置を取得"]
["                        pos = InStr(stPos, Rng.Value, str, vbTextCompare)"]
["                        '文字数を取得"]
["                        leng = Len(str)"]
["                    End If"]
["                End If"]
["            End If"]
["            "]
["            If pos > 0 Then"]
["                '一致する文字列が存在する"]
["                "]
["                '検索文字のセル情報に従って、太字(True/False)を設定"]
["                Rng.Characters(pos, leng).Font.Bold = TextRng.Font.Bold"]
["                '検索文字のセル情報に従って、斜字(True/False)を設定"]
["                Rng.Characters(pos, leng).Font.Italic = TextRng.Font.Italic"]
["                '検索文字のセル情報に従って、フォント色を設定"]
["                Rng.Characters(pos, leng).Font.Color = TextRng.Font.Color"]
["                                               "]
["                '検索開始位置をずらす。残りの文章で再検索"]
["                stPos = pos + leng - 1"]
["                "]
["            Else"]
["                Exit For"]
["                "]
["            End If"]
["            "]
["        Next"]
["        "]
["    Next"]
["    "]
["    フォント変更 = True"]
["    Set Rng = Nothing"]
["    "]
["End Function"]
[]
["Option Explicit"]
["' **********************************************"]
["'  正規表現の記号にエスケープ記号を付加する"]
["' **********************************************"]
["Function SetEscape(ByRef chgStr As String)"]
["     "]
["    chgStr = Replace(chgStr, \"\\\", \"\\\\\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"*\", \"\\*\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"+\", \"\\+\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \".\", \"\\.\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"?\", \"\\?\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"{\", \"\\{\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"}\", \"\\}\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"(\", \"\\(\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \")\", \"\\)\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"[\", \"\\[\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"]\", \"\\]\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"^\", \"\\^\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"$\", \"\\$\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"-\", \"\\-\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"|\", \"\\|\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"/\", \"\\/\", , , vbBinaryCompare)"]
["    chgStr = Replace(chgStr, \"\"\"\", \"\\\"\"\", , , vbBinaryCompare)"]
["     "]
["End Function"]

{"sheet":"Out","index":1,"n_rows":51,"n_cols":5,"rows_kept":51,"cut":false,"hidden":false,"merged":[]}
["関数名","testNON"]
[null,"戻り値","Long"]
["関数名","abc"]
["関数名","test"]
[null,"引数1","String","h1"]
["関数名","testLong"]
[null,"引数1","String","h1"]
[null,"戻り値","Long"]
["関数名","RExp_inStrComp"]
[null,"引数1","String","Text"]
[null,"引数2","String","format"]
[null,"引数3","Boolean","pattern"]
[null,"戻り値","Boolean"]
["関数名","RExp_FindCount"]
[null,"引数1","String","Text","ByRef"]
[null,"引数2","String","format","ByRef"]
[null,"引数3","Long","pos",1]
[null,"戻り値","Long"]
["関数名","RExp_FindStrArr"]
[null,"引数1","String","Text","ByRef"]
[null,"引数2","String","format","ByRef"]
[null,"引数3","String","returnlist()","ByRef"]
[null,"戻り値","Long"]
["関数名","RExp_Replace"]
[null,"引数1","String","Text"]
[null,"引数2","String","format"]
[null,"引数3","String","chgtext"]
[null,"引数4","Boolean","all_flg"]
[null,"戻り値","String"]
["関数名","RExp_InStr"]
[null,"引数1","Long","pos"]
[null,"引数2","String","Text"]
[null,"引数3","String","format"]
[null,"戻り値","Long"]
["関数名","RExp_FindStr"]
[null,"引数1","Long","pos"]
[null,"引数2","String","Text"]
[null,"引数3","String","format"]
[null,"戻り値","String"]
["関数名","SetEscape"]
[null,"引数1","String","chgStr","ByRef"]
["関数名","検索リスト_フォント変更"]
[null,"引数1","Worksheet","WSht"]
["関数名","フォント変更"]
[null,"引数1","Worksheet","Wst"]
[null,"引数2","Range","TextRng"]
[null,"引数3","Boolean","Reg",false]
[null,"引数4","Boolean","Word",false]
[null,"戻り値","Boolean"]
["関数名","SetEscape"]
[null,"引数1","String","chgStr","ByRef"]