I have a large text file of the below format.
{
"glossary": {
"title": "example glossary",
cm="私は今プログラミングーをしています";
"text2": "example glossary",
cm="私はABあああをしています"
}
I need to comment out the line which includes Japanese characters. There are 4 or multiple tabs at the start of this line. Tab count varies on each line. I need to change the above file as below:
{
"glossary": {
"title": "example glossary",
*/cm="私は今プログラミングーをしています";*/
"text2": "example glossary",
*/cm="私はABあああをしています";*/
}
Environment:
★ I can run a batch file.
★ I can run a VB script.
★ I can use the Sakura Editor. (preferred)
★ I cannot use/download 3rd party software.
Things I have tried.
■ Using regex ➞ I tried to replace the Japanese text with "" using regex \p{Hiragana} and then \p{Katakana} after that \p{Han} but these still remained the symbols.
■ Using VBA I have tried to read each line of text file using vba and replace the matching line with "*/" I don't know why but it replaced the whole file. The code I used is as below:
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\Users\s162138\Desktop\test.txt") then
Set objFile = objFSO.OpenTextFile("C:\Users\s162138\Desktop\test.txt", 1)
Do Until objFile.AtEndOfStream
strLine = objFile.Readline
If strNextLine = "cm=*" then
strLine = "text"+ strLine + "text"
End If
strNewText = strLine + vbcrlf
Loop
Set objFile = Nothing
Set objFile = objFSO.OpenTextFile("C:\Users\s162138\Desktop\test.txt", 2)
objFile.Write strNewText
Set objFile = Nothing
End If
I would be grateful if anyone could help me out..