Regex Help?
Charles Curley
charlescurley at charlescurley.com
Sat Oct 8 15:58:29 MDT 2011
On Sat, 8 Oct 2011 13:19:43 -0600
"S. Dale Morrey" <sdalemorrey at gmail.com> wrote:
> Ok I'll admit it, I suck at regex.
> Unfortunately, I now have the task of importing a customers catalog
> price list into a database and I'm not sure where to begin.
> I really think a simple regex could convert the whole thing to a CSV
> and I could then import the CSV directly.
>
> Here is an example of what I'm looking at.
> Item Item Description Page # Retail Member Wholesale Pkg
> 12137 HOLIDAY PENGUIN FIGURINES 335 9.95 4.25 5.95 1 PR
>
> As you can see all the fields are separated by whitespace, but then
> again so are the individual words in the description.
I wonder what kinds of white space? For example, are the fields
delimited by tabs, so that the item description field can contain
spaces. If so, a simple split on \t would do you nicely.
Perl has an excellent CSV library, which would make exporting to CSV
very easy.
--
Charles Curley /"\ ASCII Ribbon Campaign
Looking for fine software \ / Respect for open standards
and/or writing? X No HTML/RTF in email
http://www.charlescurley.com / \ No M$ Word docs in email
Key fingerprint = CE5C 6645 A45A 64E4 94C0 809C FFF6 4C48 4ECD DFDB
More information about the PLUG
mailing list