takanii回答ポイント 500ptウォッチ

VBSの質問です

a.htmlをb.htmlへ変換させるvbsを組みたいのですがどうすればいいのでしょうか?
a.html
*********************
<input type="checkbox">
hoge
<input type="checkbox">
hoge
<input type="checkbox">
hoge
<input type="checkbox">
hoge
**********************

b.html
**********************
<input id="box1" type="checkbox">
hoge
<input id="box2" type="checkbox">
hoge
<input id="box3" type="checkbox">
hoge
<input id="box4" type="checkbox">
hoge
**********************
よろしくお願いします

Dim objFile ' 対象ファイル
Dim oldText ' 置換前テキスト
Dim newText ' 置換後テキスト
Dim objRep ' 正規表現オブジェクト
Dim repText ' 置換後文字列
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("a.html")
oldText = objFile.ReadAll
repText = ""
Set objRep = New RegExp
objRep.Multiline = True
objRep.Pattern = "<input "
objRep.Global = True
newText = objRep.replace(oldText, repText)
Set objFile = objFSO.CreateTextFile("b.html")
objFile.WriteLine (newText)

※ 有料アンケート・ポイント付き質問機能は2023年2月28日に終了しました。
ログインして回答する

ベストアンサー

その他の回答

この質問へのコメント

コメントはありません

この質問への反応(ブックマークコメント)

質問の情報

登録日時
2014-02-17 19:27:45
終了日時
2014-02-17 20:10:49
回答条件
1人5回まで

この質問のカテゴリ

この質問に含まれるキーワード

正規表現647regexp46hoge915オブジェクト658HTML5036

人気の質問

メニュー

PC版