Solved

Parse a string with coldfusion

Posted on 2010-09-23
2
380 Views
Last Modified: 2012-05-10
I have a http post that will return a string like the example below.
I need to get the value of qualified.

The string will not always be in same exact character length.
How do i search string for [qualified] => then set the value to result.

<cfset result =

Array ( [success] => 1 [leadID] => 8001640 [qualified] => 1 )
0
Comment
Question by:LeadCo
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 33750678
<cfset result = "">
<cfset str = "Array ( [success] => 1 [leadID] => 8001640 [qualified] => 1 ) ">
<cfset matches = reMatchNoCase("(\[qualified\]\s+=>\s+[^\[\)]+)", str)>
<!--- if found --->
<cfif arrayLen(matches)>
      <cfset result = listLast(matches[1], "=>")>
</cfif>
<cfoutput> result = #result# </cfoutput>
0
 

Author Closing Comment

by:LeadCo
ID: 33938939
Thanks
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question