DaGrunch Posted December 28, 2006 Share Posted December 28, 2006 (edited) Hi folks!I tried to get the pattern working but i failed miserably. Whatever i did i am getting either all the text or nothing. Could anyone of you please tell me what i am doing wrong? Is there a huge difference between the regular expressions used in php and autoit? Never had so much problems working with php and regexp... This is the example code in which i highlighted the needed information.CODE<tr><td align="left" class="pg2ColHdr35"> Type: <font class="pg2ColData">94521</font></td><td align="left" class="pg2ColHdr30"> Model: <font class="pg2ColData">3213</font></td><td align="left" class="pg2ColHdr35"> Serial: <font class="pg2ColData">HGFKESA</font></td></tr><tr><td align="left" class="pg2ColHdr35"> Status: <font class="pg2ColData">Continue</font></td><td align="left" class="pg2ColHdr30"> Build Date: <font class="pg2ColData">2007-02-12</font></td><td align="left" class="pg2ColHdr35"> Build to Model: <font class="pg2ColData"> </font></td></tr><tr><td align="left" class="pg2ColHdr35"> Geography: <font class="pg2ColData">Guinea</font></td><td align="left" class="pg2ColHdr30"> Country: <font class="pg2ColData">Lebanon</font></td><td align="left" class="pg2ColHdr35"> Configuration Id: <font class="pg2ColData">1</font></td></tr><tr><td align="left" class="pg2ColHdr35"> OES Order Number: <font class="pg2ColData">26512576</font></td><td align="left" class="pg2ColHdr30"> Customer Number: <font class="pg2ColData">6564</font></td><td align="left" class="pg2ColHdr35"> Delivery Number: <font class="pg2ColData">500184571</font></td></tr><tr><td align="left" class="pg2ColHdr70" colspan="2"> Service Status: <font class="pg2ColData">The order is being processed right now.</font></td><td align="left" class="pg2ColHdr30" colspan="1"> UAR End Date: <font class="pg2ColData">2007-01-13</font></td></tr></tbody></table></td></tr>The text is much longer, but all the time i just need these two dates out of it. The page is always in the same format. I tried something like this example to see if i am totally dumb and it seems like it. CODE#include <array.au3>$sString = '<font class="pg2ColData">2007-01-13</font>'$aArray = StringRegExp($sString, '[0-9][0-9][0-9][0-9](*.?)[0-9][0-9]', 3)If Not @error Then _ArrayDisplay($aArray, "Test")which normally should show me the "-" between the year and month as a result or am i mistaken? Confusing and the regexCoach didnt help much. :"> Edited December 28, 2006 by DaGrunch Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 28, 2006 Moderators Share Posted December 28, 2006 (edited) There's a _StringBetween() in the help file.You're expression is incorrect:#include <array.au3> $sString = '<font class="pg2ColData">2007-01-13</font>' $aArray = StringRegExp($sString, '(?s)(?i)pg2ColData"\>(.*?)\<', 3) _ArrayDisplay($aArray, "Test")oÝ÷ Ù: zÛazÊ^r'âqÖzØb³¥èm¦åË +«¢+ØÀÌØíÉÉäôMÑÉ¥¹IáÀ ÀÌØíÍMÑÉ¥¹°Ìäì ý̤ ý¤¥UHÀäÈí̹ÀäÈíÌÑÀäÈìèÀäÈį́ÀäÈì±Ðí½¹ÐÀäÈí̱ÍÌÀäÈìôÅÕ½ÐíÁÉ ½±ÑÅÕ½ÐìÀäÈìÐì ¸¨ü¤ÀäÈì±ÐìÌäì°Ì¤ Edited December 28, 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...
DaGrunch Posted December 28, 2006 Author Share Posted December 28, 2006 That works! Great! Thanks! 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