|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
CFHTTP & Regex I'm horrible at regex
Here's a rad tool for extracting regex patterns: http://txt2re.com/.jonah 05/31/12 04:16 P So you want the XXX in the following?Michael Dinowitz 05/31/12 04:29 P 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> 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 ----- 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 -----
|
May 23, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||