Jump to content

Regexp (Return array of global matches) return some empty index


Recommended Posts

Lets say i have a text between " or '

test='test' test2="test2" test3='test3' test4="test4"

and i want exactly this text only

using regexp ("[^"]*")|('[^']*')

$tmp = StringRegExp( "test='test' " & 'test2="test2" ' & "test3='test3' " & 'test4="test4" ', "("&Chr(34)&"[^"&Chr(34)&"]*"&Chr(34)&")|('[^']*')", 3 )
for $loop=0 to UBound($tmp)-1
     msgbox(  0,"", "index=" & $loop & " [" & $tmp[$loop] & "]")

Return is:

index=0 []

index=1 ['test1']

index=2 ["test2"]

index=3 []

index=4 ['test3']

index=5 ["test4"]

if i use

regexp ('[^']*')|("[^"]*")

index=0 ['test1']

index=1 []

index=2 ["test2"]

index=3 ['test3']

index=4 []

index=5 ["test4"]

@ http://gskinner.com/RegExr/ and http://myregexp.com/

i've made a quick test

Am i wrong?


Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...