Solved

Parse a string with coldfusion

Posted on 2010-09-23
2
375 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

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now