Today at 4:12pm, Lloyd T Brown said:

>Here's the situation.  I'm encoding files (base 64 encoding) to put them
>into a database.  I want to also include some metadata with the encoded
>string, namely filename and mime type.  Here's an example of the format
>I decided to use.
>
>"filename: somefilename.txt;mime-type: text/plain; data:
>VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw=="

I know you're really asking for a regexp, but if I may, I'd like to
suggest you [re]consider having the meta data be stored as a separate
column in the table. This could have several benefits:

1) Don't have to parse it out of a blob/text field
2) Can use the meta data for db queries (i.e. selecting by name/type, etc.)
3) Simpler code to read and write file entries in the database
4) More flexible: much easier to expand your meta-data set later
5) That's what databases are for

But of course I don't know the entire situation, so this may not be
appropriate in your setting.

BTW, the regexp looked pretty good, and I pretty much agree with what
Jacob Fugal said.

Thanks,
Mac

--
Mac Newbold             MNE - Mac Newbold Enterprises, LLC
[EMAIL PROTECTED]       http://www.macnewbold.com/

____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to