Moderators SmOke_N Posted August 14, 2006 Moderators Share Posted August 14, 2006 (edited) I'm trying to get the vars from a string, does anyone see why it's picking up the first var and not the 2nd one? Local $a_Array = StringRegExp('$abc' & @CRLF & '$abcde', '(?i:\$)(.*?)(?i:\W\s)', 3) If IsArray($a_Array) Then For $iCount = 0 To UBound($a_Array) - 1 MsgBox(64, 'Info', 'Var ' & $iCount & ' = $' & $a_Array[$iCount]) Next EndIf Edited August 14, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Knight Posted August 14, 2006 Share Posted August 14, 2006 It was only picking up the first one because the second one did not have @CRLF on the end. Your pattern required that to be on there for it find it. I think you want this.. or something close to it atleast. Local $a_Array = StringRegExp('$abc' & @CRLF & '$abcde', '(?i:\$)(\A*)', 3) If IsArray($a_Array) Then For $iCount = 0 To UBound($a_Array) - 1 MsgBox(64, 'Info', 'Var ' & $iCount & ' = $' & $a_Array[$iCount]) Next EndIf Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 14, 2006 Author Moderators Share Posted August 14, 2006 (edited) It was only picking up the first one because the second one did not have @CRLF on the end. Your pattern required that to be on there for it find it. I think you want this.. or something close to it atleast. Local $a_Array = StringRegExp('$abc' & @CRLF & '$abcde', '(?i:\$)(\A*)', 3) If IsArray($a_Array) Then For $iCount = 0 To UBound($a_Array) - 1 MsgBox(64, 'Info', 'Var ' & $iCount & ' = $' & $a_Array[$iCount]) Next EndIfThanks for the reply Knight... Now this does indeed work with the example... but It's not working with FileRead() (Getting all the vars).... I'm stumped . Edited August 14, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 14, 2006 Author Moderators Share Posted August 14, 2006 Thanks again Knight, come to find out, yes, the code 1 was not correct the first time, and 2, I was parsing it incorrectly looking for duplicates.... I've fixed both... this is what I need '(?i:\$)(\w*)' Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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