Jump to content

Recommended Posts

Posted (edited)

Hey =)

i need some help. My problem/what i want:

A program that checks every line's ending for ".php" and if it ends with ".php"

the program writes the line to a second text file.

Example: I have a textfile with this inside:

www.google.com

www.google.com/index.php

www.youtube.com

www.youtube.com/login.php

Now i run the autoit program , and it check everyline for the ending ".php".

Now it writes every of those lines to a text document and it will look

like this:

www.google.com/index.php

www.youtube.com/login.php

Thats what it should do...

Anyone know how to make such a program?

Thanks in advance & best regards

Edited by zocker30
Posted

$re = StringRegExp(ClipGet(), '(.*.+php)', 3)
For $i = 0 to UBound($re) -1
ConsoleWrite($re[$i] & @LF)
Next

Try this when you have somthing in your Clipboard.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Posted

Or use _FileReadToArray and step through the array checking for those that end in .php. Stringright would be useful here.

You can then write the matching ones to your new file.

William

Posted (edited)

Local $a_PHP = StringRegExp(FileRead("C:PathSomefile.txt"), "(?m:^)(.*.php)(?:v|$)+", 3)
If NOT @Error Then
$hFile = FileOpen(@DesktopDir & "results.txt", 2)
$s_Txt = ""
For $i = 0 To Ubound($a_PHP) -1
         $s_Txt &= $a_PHP[$i] & @CRLF
Next
FileWrite($hFile,StringStripWS( $s_Txt, 2))
FileClose($hFile)
EndIf

Edit: Forgot to add the @CRLF and then strip the last one for the write.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

Local $a_PHP = StringRegExp(FileRead("C:PathSomefile.txt"), "(?m:^)(.*.php)(?:v|$)+", 3)
If NOT @Error Then
$hFile = FileOpen(@DesktopDir & "results.txt", 2)
$s_Txt = ""
For $i = 0 To Ubound($a_PHP) -1
         $s_Txt &= $a_PHP[$i] & @CRLF
Next
FileWrite($hFile,StringStripWS( $s_Txt, 2))
FileClose($hFile)
EndIf

Edit: Forgot to add the @CRLF and then strip the last one for the write.

Works perfect ! Thanks alot :DDD
Posted

Glad it helped.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...