gcue Posted September 16, 2024 Posted September 16, 2024 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!
Solution pixelsearch Posted September 16, 2024 Solution Posted September 16, 2024 Hi, probably the Ungreedy option ? (?Us) "I think you are searching a bug where there is no bug... don't listen to bad advice."
Nine Posted September 16, 2024 Posted September 16, 2024 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) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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