![]() |
|
Don't ask to ask, just ask | |
PerlMonks |
RE: RegExp to delete mail attachmentsby BlaisePascal (Monk) |
on Sep 12, 2000 at 01:08 UTC ( #31987=note: print w/replies, xml ) | Need Help?? |
Looking on CPAN is your best bet. If you wanted to do it yourself, I'd suggest really reading the MIME RFCs, because I can see some problems with what you have there immediately.
I'm gonna assume that the .* issues others have mentioned have been resolved, and you are using .*? for a non-greedy look-ahead. That'll help immediately. But the end-terminator for an attachment isn't "From", it's a second line matching the first "--.*" line. Worse, the proper value of the ".*" is specified on a different line, which you don't wan't to chop out. Ignoring that last problem, you could probably use something like: This should match the proper beginnings and endings better. I'd love to get rid of the .*? parts, but I'm not sure if it can be done. I though of using \S* for the first, but the boundary line can contain spaces, so that won't work.
In Section
Seekers of Perl Wisdom
|
|