Solved

Parse a string with coldfusion

Posted on 2010-09-23
2
408 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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 …
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

617 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