Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Single Post  Topic: Подсчёт к-ва раз встречающейся фразы в файле и вывод отчёта 
Author Message
Lev



PostPosted: Mon Apr 26, 2010 16:17    Post subject: Reply with quote

Вариация
Code:
'=====================================================================
' Подсчёт к-ва раз встречающейся фразы в файле и вывод отчёта
'
' Параметры:
' {файл} {фраза}
'
' Пример вызова из TC:
' %P%N "текст"
'=====================================================================
Dim fso, InFile

Set fso = CreateObject("Scripting.FileSystemObject")

Dim re

Set re = New RegExp
re.Global = True
re.IgnoreCase = True
re.MultiLine = True

InFile     = WScript.Arguments(0)
re.Pattern = WScript.Arguments(1)

s = re.Execute(fso.OpenTextFile(InFile,1).ReadAll).Count

msgbox "Фраза """ & re.Pattern & """ повторяется в тексте " & s & " раз(а)"
Set fso = Nothing
Set re = Nothing
WScript.Quit
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group