You can get the first and second lines based on a new line delimited list
and you can get the items in the second line using a space delimited list. I
just like to be specific when parsing data from a source like email. My
preference is to pop 2 messages, save the first in a DB (raw) and use the
second as a flag to rerun the page. Once all the mail is down and stored in
the DB (one at a time, there's a reason), I have a second process parse each
message in the tightest way possible. I'm paranoid (as all programmers
should be) about data from outside sources and I want to be 100% sure of
what I'm getting and how. If there's a problem, then I want to know exactly
what's up.

  _____  

Why don;t you just go through the text as a list with CR as the
delimiter? This way you can have much more focused regular
expressions.

Just a thought,

Ian

----- Original Message -----
From: Michael Dinowitz <[EMAIL PROTECTED]>
Date: Mon, 30 Aug 2004 16:49:48 -0400
Subject: RE: regexp help
To: CF-Talk <[EMAIL PROTECTED]>

Really fast (Using the multi-line move of CFMX)

^([^#chr(13)#]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]{2
}/[0-9]{2}/[0-9]{4})[[:space:]]+(USD)?[[:space:]]*([0-9.]+)$

   _____  

From: chris porter [mailto:[EMAIL PROTECTED]
Sent: Monday, August 30, 2004 4:41 PM
To: CF-Talk
Subject: Re: regexp help

and one last time....

DATA:

Product Name
Product Number            Qty      Est. Ship Date                 Your Ext.
Price
[dashed go here all the way across PITA email parser]

description of some item1
0344437                     1           03/12/2004                 USD
335.75

another description of some item1
0344734                     1           03/12/2004                 USD
335.75

and one last description of some item
0433447                     1           03/12/2004                 USD
335.75

part i need parsed by a regex

"description of some item1
0344437                     1           03/12/2004                 USD
335.75"

current REGEX:
([0-9]+)[ ]+([0-9]+)[ ]+([^ ]+)[ ]+([A-Z]{3})[ ]+([0-9.]+)

that regex matches everything on the 2nd line correctly, but nothing i add
to the beginning will match the first line. any thoughts?

Thanks!
-Chris
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to