House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

CFHTTP & Regex I'm horrible at regex

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Roger Anthony
05/31/2012 04:11 PM

I'm trying to pull total impressions from the administration screens on a Xerox printer but for the life of me can't seem to get the regex right. I'm thinking the Less Than and Greater Than signs are what's tripping me up, but as frustrated as I am at the moment I can't tell you for sure. So, without further ado.. how the heck would you parse the filecontent to look for the variable value that is "113067" below?  Thanks in advance! <td width=60%>Total Impressions</td> <td width=5%>113067</td> <td width=35%>Impressions</td>

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
.jonah
05/31/2012 04:16 PM

Here's a rad tool for extracting regex patterns: http://txt2re.com/ It even outputs CF code. (I't output is pretty generic, but is a good staring point and gives nice insight into how RE works.) .jonah On 5/31/12 1:10 PM, Roger Anthony wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Michael Dinowitz
05/31/2012 04:29 PM

So you want the XXX in the following? <td width=60%>Total Impressions</td> <td width=5%>XXX</td> <td width=35%>Impressions</td> What you want is <td width=5%>(.*?)</td> (.*?) = capture any character, zero or more times, but only as many as needed until the next part of the expression. This will capture everything until a closing </td>. I did it this way just in case there is a value in it with brackets. If its only going to be numbers then ([0-9]+) will work. If this is not exactly what your looking for, please give some more details and I'll craft something better. On Thu, May 31, 2012 at 4:10 PM, Roger Anthony <doa@anthony2.net> wrote: ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 23, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference