Greetings TB! Users,

I've said it many times. Regular expressions drive me nuts. So when I
have no scripting language to my disposal, and I'm left with only
regular expressions and macros (or constants or objects or whatever
you'd like to call them today <g>), I'm lost.

I've been trying to figure out how I can figure out if the message
being replied to is either multipart/mixed or text/html. I can do
that, but what I don't understand is how I can act on that based on
whether or not either one of those content-types are present.

In Perl (which is what I know best), one could simply:

(Untested, using the fictional $HEADERS var in a somewhat realistic
setting.)

$HEADERS  = "To: kung\@foo.com\n";
$HEADERS .= "Content-type: text/html\n";
$response = ($HEADERS =~ m!content-type:\s*(multipart/mixed|text/html)!is ? 'Not 
text/plain' : 'text/plain');
print "$response\n";

Or the rather lengthy version:

$HEADERS  = "To: kung\@foo.com\n";
$HEADERS .= "Content-type: text/html\n";
if($HEADERS =~ m!content-type:\s*(multipart/mixed|text/html)!is) {
  $response = 'Not text/plain';
} else {
  $response = 'text/plain';
}
print "$response\n";

Or if $HEADERS was a built-in (Ie. %HEADERS in TB!):

print($HEADERS =~ m!content-type:\s*(multipart/mixed|text/html)!is ? 'Not text/plain' 
: 'text/plain');

Now, how can I do that using only TB!'s built in regex and macro stuff?

I'm just trying to add in a single sentence if, and only if, the
sender is using HTML or Rich-Text settings.

I'm guessing the "..and only if" part of that last sentence means I
can't do this.

--
...................................................................
 Brian Clark <[EMAIL PROTECTED]>     PGP-KeyID: 0xE4D0C7C8
 Web Architect, Designer, and Programmer  Tel: 864.227.0750
 http://www.fusionwerks.com/              Fax: 864.942.7249
...................................................................
 TB! 1.49e, Windows 98 (SE) 4.10 Build 2222 A 

-- 
______________________________________________________
Archives   : <http://tbtech.thebat.dutaint.com>
Moderators : <mailto:[EMAIL PROTECTED]>
Unsubscribe: <mailto:[EMAIL PROTECTED]>

Reply via email to