ChrisO 0 Posted September 22, 2010 Hey all, I'm trying to parse a html page using StringRegExp to pull out some names that are useful to me. The portion of the html is: <select name='list_ck[]' size="10" multiple="multiple" style='width:250px'> <option value='jsmith'>John Smith</option><option value='esmith'>Eddie Smith</option> </select> The number of names can be any where from 0 to 4 and I need to grab each one. Here's what I have so far: $regexpResults = StringRegExp($dlPOc,"list_ck[^<]+(?:<option\svalue='\w+'>([^<]+)</option>)*\s",3) Am I over-complicating this? It seems like what I have should work but it only returns the last name (Eddie Smith) in this case. Thanks in advance. Share this post Link to post Share on other sites
footswitch 1 Posted September 22, 2010 Take a look here Share this post Link to post Share on other sites
kaotkbliss 146 Posted September 22, 2010 Did you try looping through your array of results? For $i=1 to Ubound($regexpResults)-1 msgbox(0,"",$regexpResults[$i]) Next if that goesn't work try the flag 1 instad of flag 3? 010101000110100001101001011100110010000001101001011100110010000001101101011110010010000001110011011010010110011100100001My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueekWe're gonna need another Timmy! Share this post Link to post Share on other sites
footswitch 1 Posted September 22, 2010 (edited) $html="<select name='list_ck[]' size=""10"" multiple=""multiple"" style='width:250px'>"&@CRLF& _ "<option value='jsmith'>John Smith</option><option value='esmith'>Eddie Smith</option> </select>" $array1=StringRegExp ($html, "(?s)(?i)<select name='list_ck(.+?)</select>",3) ; sets flag "(?s)", which means: "." matches any character including newline ; sets flag "(?i)", which means: case insensitive If @error==1 Then ConsoleWrite("-> No matches for first RegExp!"&@CRLF) _ArrayDisplay($array1) ; joins all the results in a single string: $string="" For $i=0 To UBound($array1)-1 $string&=$array1[$i] Next $array2=StringRegExp ($string, "(?s)(?i)<option value='.+?'>(.+?)</option>",3) If @error==1 Then ConsoleWrite("-> No matches for second RegExp!"&@CRLF) _ArrayDisplay($array2) EDIT: my browser is going nuts Edited September 22, 2010 by footswitch Share this post Link to post Share on other sites
ChrisO 0 Posted September 22, 2010 Thanks both, as soon you pointed me towards using 2 passes with the regex, it became much simpler. Problem solved Share this post Link to post Share on other sites