6 posts in this topic
I do have a question
<div class="col-sm-5 text-right"> <a href="/">IP Your adress: 22.214.171.124</a> </div>
Is it true?
Need help with StringRegExp
hello, i'm new to this function so i need some help doing this,
btw, i need to clear up my folder of work by deleting some files
example file inside folder :
info000001 to info999999
but i want to delete files name other than info(number)
Func _delete() $dir = @ScriptDir & '\information' $cFiles = _FileListToArray($dir & '\', "*.xml", 1) If IsArray($cFiles) Then For $number To $cFiles ;need to use StringRegExp here ;$stringRExp If $cFiles[$number] <> $stringRExp Then FileDelete($cFiles[$number] EndIf Next EndIf EndFunc
Retrieve xtring from Google Search results
how can I use the StringRegEx function to extract certain lines of text from google search results in the following format:
C: server port user password
an example is this:
C: starteam.myftp.org 18000 test1 text2
RegExp help desired
yes I already noticed the StringRegExp AutoIt reference and the very good german tutorial of SEuBo, but nevertheless I would be pleased to get a tip.
I have strings like this:
'repair car "do it your self" check'
' repair car toyota'.
There could be none, one or more words in quotation marks. It could be also that no expression is set in quotation marks (-->" "). The words of the string vary. I would like to generate an array like [repair, car, do it your self, check] or [repair, car, toyota]. Expressions in quotation marks (" ") should not be splitted.
Probably I could use string split and similar methods to combine the words in quotation marks afterwards. But that's not the way I'd like to do it.
I already got this reg-exp to extract just the complete expressions in quotation marks (" ") to seperate these from the rest of the terms:
Local $aExtract4 = StringRegExp($sTest4, '.*?"(.*?)".*?',3) Moreover I found this reg-exp to work similar to StringSplit with a " " as a delimiter. This would probably a solution if I didn't like to keep the terms in quotations marks together.... :
Local $aExtract8 = StringRegExp($sTest4, '(.+?(?:\s|\z))',3) Nevertheless I failed to find a single reg-exp that is able to met both conditions. I am convincend that it is possible to design a single reg-exp that met both conditions! I already tried different scenarios with operators like or |, the conditional (?(?= ) clause and the use of assertion (Lookahead / -behind) but without success.
I would appreciate a hint from an "reg-exp expert" if it's able to solve my problem with a single reg-exp and / or to give me some hints how to do that.
Many thanks in advance.
StringInStr - can this script be faster? (texts files included)
As always, sorry for my bad english.
here is the code i have
#include <File.au3> #include <String.au3> $file1 = "d:\doppioniautoit\international.txt" FileOpen($file1, 0) $file2 = "d:\doppioniautoit\standard.txt" FileOpen($file2, 0) For $i = 1 to _FileCountLines($file1) $line = FileReadLine($file1, $i) $aExtract = _StringBetween($line, "(", ")") ;MsgBox(0, $line, $aExtract) $itime = TimerInit() For $x = 1 to _FileCountLines($file2) $line2 = FileReadLine($file2, $x) Local $iPosition = StringInStr($line2, $aExtract, 1) ;Local $iPosition = StringRegExp($line2,$aExtract, 0) if $iPosition <> 0 then ;MsgBox(0, "Trovato", $aExtract & " " & $line2) endif ConsoleWrite($line2 & @CRLF) Next ConsoleWrite(@TAB&'Str='&TimerDiff($itime)&' ms'&@lf) MsgBox(0, "TIME", @TAB&'Str='&TimerDiff($itime)&' ms'&@lf) Next FileClose($file1) So, what do i want to do? I try to explain with my poor english Basically, i have 2 text files (see attachments below). They both contains movie titles with Director and Year in this form
Movie Title (Director, Year)
"Standard.txt" contains, mostly, italian titles. "International.txt", as you can image, contains the internationals one. With the script i would like to search for the Director, Year of "international.txt" in the "standard.txt" file.
For example... first row of "international.txt" is "¡Atraco! (Cortés, 2012)". The script takes just the "Cortés, 2012" and it searches for it in the standard. txt file.
The simple code i wrote works... I tried using StringInStr and using StringRegExp.. they both need about 2 minutes and 30 seconds (stringinstr is little faster) to process one row.
I was wondering... is there any other method to make it faster using autoit? Any help would be much appreciated, thx!