MikeP Posted May 31, 2008 Posted May 31, 2008 (edited) Hi. This might be easy but I can't seem to find the answer. I'm parsing a file to get such strings : <TD><blhalbhal><A HREF="subdir/blahblah.htm"> </TD> Then I need to use StringRegExp to search for the HREF="subdir/ characters. My problem is I can't write this : $test = StringRegExp($string, "A HREF="subdir/", 0) because the " after the = is finishing the parameter... I don't know if I'm clear or not but If you understood and know how to do this I'd be glad that you'd show me as I'm clueless till now.... Thanks ! Edited May 31, 2008 by MikeP
Developers Jos Posted May 31, 2008 Developers Posted May 31, 2008 Not sure I understand what you want accomplish but is this what you mean? $string = '<TD><blhalbhal><A HREF="subdir/blahblah.htm"> </TD>' $array = StringRegExp($string, 'A HREF="(.*?)"', 3) for $i = 0 to UBound($array) - 1 msgbox(0, "RegExp Test with Option 3 - " & $i, $array[$i]) Next SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
MikeP Posted May 31, 2008 Author Posted May 31, 2008 (edited) well I think I asked too fast. I found the answer. To search for " without having to type it (since it would be wrong syntaxically speaking..because it ends the string to test) I had to use the ASCII code which is 042 for the " .. and in regexps it's written like this \### ascii code in octal thus : wrong : $test = StringRegExp($string, "A HREF="subdir/", 0)oÝ÷ Ú¸ Ö®¶sbb33c·FW7BÒ7G&æu&VtWb33c·7G&ærÂgV÷C´$TcÒb3#²b3C³C'7V&F"ògV÷C²Â Edited May 31, 2008 by MikeP
Moderators SmOke_N Posted May 31, 2008 Moderators Posted May 31, 2008 $test = StringRegExp($string, 'A HREF="subdir/"') If ($test) Then MsgBox(64, "Info", "Sub Directory Exists.") 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.
MikeP Posted May 31, 2008 Author Posted May 31, 2008 (edited) $test = StringRegExp($string, 'A HREF="subdir/"') If ($test) Then MsgBox(64, "Info", "Sub Directory Exists.") well for that case your solution works but I also had such strings to test : java script:function("blabh"),'test','200') so .. ASCII is mandatory here since there are " and ' in the string to test or it would come to be quite awful syntax with such thing like : StringRegExp($string, 'java script:function("blahblah"),'&"'test','200')") horrible Edited May 31, 2008 by MikeP
Moderators SmOke_N Posted May 31, 2008 Moderators Posted May 31, 2008 well for that case your solution works but I also had such strings to test :java script:function("blabh"),'test','200')so .. ASCII is mandatory here since there are " and ' in the string to testSince we have the ability to concatenate strings, the ASCII is not mandatory, but if it is your preference that is fine as well . 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.
Developers Jos Posted May 31, 2008 Developers Posted May 31, 2008 (edited) well for that case your solution works but I also had such strings to test : java script:function("blabh"),'test','200') so .. ASCII is mandatory here since there are " and ' in the string to test Not really: Just double them up like: ' java script:function("blabh"),''test'',''200'')' Jos Edited May 31, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
MikeP Posted May 31, 2008 Author Posted May 31, 2008 (edited) well that's what I typed in my previous post but I prefer using ASCIIs Edited May 31, 2008 by MikeP
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