brodie28 Posted July 27, 2006 Share Posted July 27, 2006 I attatched the text file of all the source code... I need a string reg exp pattern that will return the "598,093" and the "1,965,000" in the example. The problem I am having is that the commas are a problem, and the numbers can range from 0 to anywhere in the billions... With a comma after every three digits. The other problem is that their are other parts in the source code which are exactly the same.... I was thinking a way around this would be to write the source to a file and then use FileReadLine to read the specific line which would make a StringRegExp pattern easier. I would be assuming that the line it is on never changes though.qwerty.txt Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 27, 2006 Share Posted July 27, 2006 Hi, without RegExp, just to check whether this is what you want. #include <file.au3> Dim $aRecords If Not _FileReadToArray("numbersTest.txt",$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] If StringInStr($aRecords[$x], 'ZE: 8pt; COLOR: #c1ed14" align=right><B><FONT face="Arial, Helvetica, sans-serif" size=2>Nairagua:</FONT> </B></TD>') <> 0 Then MsgBox(0,"", _StringBetween1($aRecords[$x+1], "size=2>", "</")) EndIf If StringInStr($aRecords[$x], '<TD vAlign=top width="50%">') <> 0 Then MsgBox(0,"", _StringBetween1($aRecords[$x-1], 'value="', "Nairagua")) EndIf Next Func _StringBetween1($s_String, $s_Start = 0, $s_End = 0) $s_Start = StringInStr($s_String, $s_Start) + StringLen($s_Start) Return StringMid($s_String, $s_Start, StringInStr($s_String, $s_End) - $s_Start) EndFunc ;==>_StringBetween1 So long, Mega 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 Link to comment Share on other sites More sharing options...
brodie28 Posted July 27, 2006 Author Share Posted July 27, 2006 Yes, that is it. Although, having them saved to non-array variables would make my script alot easier to manage. I also need it to find the two numbers not from a file, but from a string stored in a variable. Basically, I will store the source code into $source and need it to find it from there. Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 27, 2006 Share Posted July 27, 2006 Yes, that is it.Although, having them saved to non-array variables would make my script alot easier to manage. I also need it to find the two numbers not from a file, but from a string stored in a variable.Basically, I will store the source code into $source and need it to find it from there.Hi,so does the script do what you need? Save them into non-array vars? <-- You mean the file? You can StringSplit your $source and then just use the code above. So long,Mega 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now