Jump to content
Sign in to follow this  

StringRegExp multiple returns

Recommended Posts

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

Did you try looping through your array of results?

For $i=1 to Ubound($regexpResults)-1



if that goesn't work try the flag 1 instad of flag 3?



My Android cat and mouse game

We're gonna need another Timmy!

Share this post

Link to post
Share on other sites

$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)

; joins all the results in a single string:
For $i=0 To UBound($array1)-1

$array2=StringRegExp ($string, "(?s)(?i)<option value='.+?'>(.+?)</option>",3)
If @error==1 Then ConsoleWrite("-> No matches for second RegExp!"&@CRLF)

EDIT: my browser is going nuts

Edited by footswitch

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...