Hello again,

I know that I keep asking for regexp advice from the group. I hope you'll forgive me. I just want to get some more feedback before I put one of these in a production environment.

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=="

So, I think the regexp that would allow me to extract the filename, mime-type, and the data itself, is this:

/^filename:\s+([-_.a-zA-Z0-9]+);mime-type:\s+([-_/a-zA-Z0-9]+);data:\s(.*)$/


I'm not a regexp guru, but I think this should work. If there's something I'm missing, I hope people will let me know. Also, are those character classes sufficient for filenames and mime-types respectively?


Any help would be appreciated.

Thanks,
Lloyd Brown

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

Reply via email to