Google says:
beve
(08.11.10 ):
[color=#009933][i];Написано на языке Autoit[/i][/color]
[url=http://www.autoitscript.com/autoit3/docs/keywords.htm##include][color=#F000FF][i]#include[/i][/color][/url] [color=#9999CC]<[color=#009933][i];Array.au3>[/i][/color]
[color=#AA0000]$DicFile[/color][color=#FF0000]=[/color][url=http://www.autoitscript.com/autoit3/docs/macros.htm#@scriptdir][color=#FF33FF]@ScriptDir[/color][/url] [color=#FF0000]&[/color] [color=#9999CC]"\Dic.txt"[/color]
[url=http://www.autoitscript.com/autoit3/docs/keywords.htm#If][color=#0000FF]if[/color][/url] [url=http://www.autoitscript.com/autoit3/docs/keywords.htm#Not][color=#0000FF]not[/color][/url] [url=http://www.autoitscript.com/autoit3/docs/functions/FileExists.htm][color=#000090][i]FileExists[/i][/color][/url][color=#FF0000]([/color]<span class="S9">$DicFile[/color][color=#FF0000])[/color] [url=http://www.autoitscript.com/autoit3/docs/keywords.htm#Then][color=#0000FF]then[/color][/url]
[url=http://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm][color=#000090][i]MsgBox[/i][/color][/url][color=#FF0000]([/color][color=#AC00A9][i]48[/i][/color][color=#FF0000],[/color] [color=#9999CC]'Ошибка.'[/color][color=#FF0000],[/color] [color=#9999CC]"Не найден файл словаря - Dic.txt"[/color][color=#FF0000])[/color]
[url=http://www.autoitscript.com/autoit3/docs/keywords.htm#Exit][color=#0000FF]Exit[/color][/url]
[url=http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf][color=#0000FF]endif[/color][/url]
[color=#AA0000]$fileOpen[/color][color=#FF0000]=[/color] [url=http://www.autoitscript.com/autoit3/docs/functions/FileOpen.htm][color=#000090][i]Fileopen[/i][/color][/url][color=#FF0000]([/color][color=#AA0000]$DicFile[/color][color=#FF0000])[/color]
[color=#AA0000]$FileRead[/color] [color=#FF0000]=[/color] [url=http://www.autoitscript.com/autoit3/docs/functions/FileRead.htm][color=#000090][i]FileRead[/i][/color][/url] [color=#FF0000]([/color][color=#AA0000]$fileOpen[/color][color=#FF0000])&[/color][url=http://www.autoitscript.com/autoit3/docs/macros.htm#@crlf][color=#FF33FF]@CRLF[/color][/url]
[url=http://www.autoitscript.com/autoit3/docs/functions/FileClose.htm][color=#000090][i]FileClose[/i][/color][/url][color=#FF0000]([/color][color=#AA0000]$fileOpen[/color][color=#FF0000])[/color]
[color=#AA0000]$Var[/color][color=#FF0000]=[/color][url=http://www.autoitscript.com/autoit3/docs/functions/InputBox.htm][color=#000090][i]InputBox[/i][/color][/url][color=#FF0000]([/color][color=#9999CC]"Поиск в словаре"[/color][color=#FF0000],[/color] [color=#9999CC]"Введите, что вы хотите найти (по шаблону для поиска)"[/color][color=#FF0000])[/color]
[url=http://www.autoitscript.com/autoit3/docs/keywords.htm#If][color=#0000FF]If[/color][/url] [color=#AA0000]$Var[/color][color=#FF0000]<>[/color][color=#9999CC]""[/color] [url=http://www.autoitscript.com/autoit3/docs/keywords.htm#Then][color=#0000FF]then[/color][/url]
[url=http://www.autoitscript.com/autoit3/docs/keywords.htm#If][color=#0000FF]if[/color][/url] [url=http://www.autoitscript.com/autoit3/docs/functions/StringInStr.htm][color=#000090][i]StringInStr[/i][/color][/url][color=#FF0000]([/color][color=#AA0000]$Var[/color][color=#FF0000],[/color][color=#9999CC]"."[/color][color=#FF0000])[/color] [url=http://www.autoitscript.com/autoit3/docs/keywords.htm#Then][color=#0000FF]then[/color][/url] [color=#AA0000]$Var[/color][color=#FF0000]=[/color][url=http://www.autoitscript.com/autoit3/docs/functions/StringReplace.htm][color=#000090][i]StringReplace[/i][/color][/url][color=#FF0000]([/color][color=#AA0000]$Var[/color][color=#FF0000],[/color][color=#9999CC]"."[/color][color=#FF0000],[/color][color=#9999CC]""[/color][color=#FF0000])[/color] [color=#009933][i];чтоб небыло ошибки в поиске, если пользователь случайно ввел точку[/i][/color]
[url=http://www.autoitscript.com/autoit3/docs/keywords.htm#If][color=#0000FF]if[/color][/url] [url=http://www.autoitscript.com/autoit3/docs/functions/StringInStr.htm][color=#000090][i]StringInStr[/i][/color][/url][color=#FF0000]([/color][color=#AA0000]$Var[/color][color=#FF0000],[/color][color=#9999CC]"?"[/color][color=#FF0000])[/color] [url=http://www.autoitscript.com/autoit3/docs/keywords.htm#Then][color=#0000FF]then[/color][/url] [color=#AA0000]$Var[/color][color=#FF0000]=[/color][url=http://www.autoitscript.com/autoit3/docs/functions/StringReplace.htm][color=#000090][i]StringReplace[/i][/color][/url][color=#FF0000]([/color][color=#AA0000]$Var[/color][color=#FF0000],[/color][color=#9999CC]"?"[/color][color=#FF0000],[/color][color=#9999CC]".?"[/color][color=#FF0000])[/color] [color=#009933][i];корриктировка шаблона для поиска[/i][/color]
[url=http://www.autoitscript.com/autoit3/docs/keywords.htm#If][color=#0000FF]if[/color][/url] [url=http://www.autoitscript.com/autoit3/docs/functions/StringInStr.htm][color=#000090][i]StringInStr[/i][/color][/url][color=#FF0000]([/color][color=#AA0000]$Var[/color][color=#FF0000],[/color][color=#9999CC]"*"[/color][color=#FF0000])[/color] [url=http://www.autoitscript.com/autoit3/docs/keywords.htm#Then][color=#0000FF]then[/color][/url] [color=#AA0000]$Var[/color][color=#FF0000]=[/color][url=http://www.autoitscript.com/autoit3/docs/functions/StringReplace.htm][color=#000090][i]StringReplace[/i][/color][/url][color=#FF0000]([/color][color=#AA0000]$Var[/color][color=#FF0000],[/color][color=#9999CC]"*"[/color][color=#FF0000],[/color][color=#9999CC]".*?"[/color][color=#FF0000])[/color] [color=#009933][i];коректировка шаблона для поиска[/i][/color]
[color=#AA0000]$aArray[/color][color=#FF0000]=[/color][url=http://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm][color=#000090][i]StringRegExp[/i][/color][/url][color=#FF0000]([/color][color=#AA0000]$FileRead[/color][color=#FF0000],[/color][color=#9999CC]"(?s)"[/color][color=#FF0000]&[/color][color=#AA0000]$Var[/color][color=#FF0000]&[/color][color=#9999CC]"\r\n"[/color][color=#FF0000],[/color] [color=#AC00A9][i]3[/i][/color][color=#FF0000])[/color]
[url=http://www.autoitscript.com/autoit3/docs/keywords.htm#If][color=#0000FF]if[/color][/url] [url=http://www.autoitscript.com/autoit3/docs/functions/IsArray.htm][color=#000090][i]IsArray[/i][/color][/url][color=#FF0000]([/color][color=#AA0000]$aArray[/color][color=#FF0000])[/color] [url=http://www.autoitscript.com/autoit3/docs/keywords.htm#Then][color=#0000FF]then[/color][/url]
[url=http://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm][color=#000090][i]MsgBox[/i][/color][/url][color=#FF0000]([/color][color=#AC00A9][i]64[/i][/color][color=#FF0000],[/color][color=#9999CC]"Найденные совпадения:"[/color][color=#FF0000],[/color] [url=http://dundats.mvps.org/help/html/libfunctions/_arraytostring.htm][color=#808080][i]_ArrayToString[/i][/color][/url][color=#FF0000]([/color][color=#AA0000]$aArray[/color][color=#FF0000],[/color][color=#9999CC]""[/color][color=#FF0000]))[/color]
[url=http://www.autoitscript.com/autoit3/docs/keywords.htm#Else][color=#0000FF]Else[/color][/url]
[url=http://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm][color=#000090][i]MsgBox[/i][/color][/url][color=#FF0000]([/color][color=#AC00A9][i]0[/i][/color][color=#FF0000],[/color][color=#9999CC]"Сообщение"[/color][color=#FF0000],[/color] [color=#9999CC]"Не найдено совпадений."[/color][color=#FF0000])[/color]
[url=http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf][color=#0000FF]EndIf[/color][/url]
[url=http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf][color=#0000FF]Endif[/color][/url]
beve
(08.11.10 ):
Ой, извиняюсь. Я по привычке вставил код для форума...
Вот решение задачи:
;Написано на языке Autoit
#include <Array.au3>
$DicFile=@ScriptDir & "\Dic.txt"
if not FileExists($DicFile) then
MsgBox(48, 'Ошибка.', "Не найден файл словаря - Dic.txt")
Exit
endif
$fileOpen= Fileopen($DicFile)
$FileRead = FileRead ($fileOpen)&@CRLF
FileClose($fileOpen)
$Var=InputBox("Поиск в словаре", "Введите, что вы хотите найти (по шаблону для поиска)")
If $Var<>"" then
if StringInStr($Var,".") then $Var=StringReplace($Var,".","") ;чтоб небыло ошибки в поиске, если пользователь случайно ввел точку
if StringInStr($Var,"?") then $Var=StringReplace($Var,"?",".?") ;корриктировка шаблона для поиска
if StringInStr($Var,"*") then $Var=StringReplace($Var,"*",".*?") ;коректировка шаблона для поиска
$aArray=StringRegExp($FileRead,"(?s)"&$Var&"\r\n", 3)
if IsArray($aArray) then
MsgBox(64,"Найденные совпадения:", _ArrayToString($aArray,""))
Else
MsgBox(0,"Сообщение", "Не найдено совпадений.")
EndIf
Endif
Михаил
(06.12.12 ):
На шарпе можно регулярки заюзать=)