Jump to content

multiple stringregexp matches


Go to solution Solved by pixelsearch,

Recommended Posts

Posted

i have an xml that has several hundred of these entries 

{"id":"00c7a9-180b-384-8321-6f08","displayName":"Bill Toki (BLT)","firstName":"Bill","lastName":"Toki","emailAddress":"Bill. Toki@xyz.com","externalId":"7e9-22de-4f87-86b-6ed","enriched":true}

i am trying to get all values that are between parenthesis.  in the example above BLT

this is what i have so far but not sure why i am not getting all matches - only the last instance 

$array = StringRegExp($data, "(?s).*\((.*)\).*", 3)

thank you in advance!

 

Posted

or this simple :

#include <Array.au3>
#include <Constants.au3>

Local $sTest = '{"id":"00c7a9-180b-384-8321-6f08","displayName":"Bill Toki (BLT)","firstName":"Bill","lastName":"Toki","emailAddress":"Bill. Toki@xyz.com","externalId":"7e9-22de-4f87-86b-6ed","enriched":true}' & @CRLF & _
  '{"id":"00c7a9-180b-384-8321-6f08","displayName":"Bill Toki (BLT)","firstName":"Bill","lastName":"Toki","emailAddress":"Bill. Toki@xyz.com","externalId":"7e9-22de-4f87-86b-6ed","enriched":true}' & @CRLF & _
  '{"id":"00c7a9-180b-384-8321-6f08","displayName":"Bill Toki (BLT)","firstName":"Bill","lastName":"Toki","emailAddress":"Bill. Toki@xyz.com","externalId":"7e9-22de-4f87-86b-6ed","enriched":true}' & @CRLF & _
  '{"id":"00c7a9-180b-384-8321-6f08","displayName":"Bill Toki (BLT)","firstName":"Bill","lastName":"Toki","emailAddress":"Bill. Toki@xyz.com","externalId":"7e9-22de-4f87-86b-6ed","enriched":true}'

Local $aTest = StringRegExp($sTest, "\(.*?\)", $STR_REGEXPARRAYGLOBALMATCH)
_ArrayDisplay($aTest)

 

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
×
×
  • Create New...