Pages: 1
RSS
RegExp not working
 
I am searching for this text in my incoming e-mail:

Comment:
This is the user's comment.

There is one space after the Comment: and before the carriage return.

Here is my template in the "Forward Message" action in my filter:

%SetPattRegExp="(?is)(.*?)Comment:\s\n(.*?)\n"%-
%RegExpBlindMatch="%Text"%-
%SubPatt="2"

The filter runs and all I get at the destination is the Subject, I do not get any text in the body of the message.

I do not know RegExp at all, I was trying to figure this out by reading the forum, but no joy....

Can you help me? Thank you.

Jason

 
I found that the trailing hyphens were a problem. I removed them and now get a message with the correct Comment: in the body, but there is no TO: or Subject: in the headers.
 
It isn't quite clear to me what you want to achieve.

With the template you posted you shouldn't get anything else then the contents of the Comment header in your message body, so that is as it should be.
Though you're using a rather complicated way to retrieve the contents of that header, you can insert the contents of any header with the %Header("header name") macro, in this case that would be be: %Header("Comment")
As the Comment header is a special case, you could also use %Comment

Your complaint is that this is the only thing in the message body, there's nothing more that you specified.
In case you want the full original message text in the body, you should add the %Text macro to your template.
In case you don't want the full text, you should be more specific.

The To: header should be the addressee that you set in the action properties, the %Subject should be added automatically.

But let's start this systematically. What are the contents you want in your new message nand why?
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Okay, let's start.

I want the Comment: text in the body.
The Comment: blah blah blah is not in the headers, it is in the body of the message I receive, with a bunch of other stuff.

I get these messages from my blog when people post comments.

My goal is to reduce the message to be a subject of my choosing, and only the Comment: entry from the original message and then send that newly formatted message to my cell phone via mycellnumber@vtext.com

If I leave the subject in tact, it makes the message too long and I don;t get the body of the message at my cell phone.

So, what I want in my new message is essentially this:

%SetPattRegExp="(?is)(.*?)Comment:\s\n(.*?)\n"%
%RegExpBlindMatch="%Text"%
%SubPatt="2"
%FROMADDR
%SUBJECT="BlogPost"
%TO="??????????@vtext.com"

but the TO and Subject are blank when it gets put in the outbox for sending.
 
OK, I get it.

But there should be no reason at all to omitt the dashes at the end of the line, the %- macro skips the empty line that's caused by the fact that the macros in front of it leave no text in the message body.

Your %FromAddr macro isn't necessary, it only inserts your own address in the message body and I presume that you know that. :-)

The %Subject="BlogPost" should do the trick with regard to the subject, but it'll add a new empty line to your message body, so you'd better follow it up with a %- macro.
Your %To= macro is messing things up. Because you define the addressee in the forwarding action of the filter action, the defined address should be added to the primary addressee. Unfortunately these templates aren't executed in one run and that means that some macros and filter actions properties are interpreted more than once.
Presumably you've left the addressee in the filer action blank and that's the property that is winning out. So you should skip the %To= macro and define the addressee in the filter action properties.
The same mishmash could be happening with the subject, but we use a different procedure for that. We set that header to be modified only once, that's to be done with the %ModifyOnce macro.
So basically I'd advise this template:

%SetPattRegExp="(?is)(.*?)Comment:\s\n(.*?)\n"%-
%RegExpBlindMatch="%Text"%-
%SubPatt="2"
%ModifyOnce("Subject")%-
%Subject="BlogPost"%-

Good luck.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Thanks. You see what I want to do.  I am using the "Create a Formatted Message" action, not the forward.

Your macros create the message and leave the TO and SUBJECT blank, so it sits in my outbox with no place to go.

I'll try it as a forward right now and see what happens.

Same result. I'll paste the kludges here from the message that is left in the outbox.

Date: Thu, 27 Nov 2008 20:59:55 -0500
From: "Staff at Surprise Party Inc." <Admin@His40th.com>
Organization: Surprise Party Inc.
Message-ID: <794131453.20081127205955@His40th.com>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable




We know who, when and where.  What else is there?
 
Closed the bat and restarted it..... All is working now! thanks!
 
Interesting, every time I make a change to a filter with a macro in it, I have to restart the bat in order for it to take effect.
 
Never noticed that myself, but it's possible, I'll keep an eye open for that behaviour.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
Pages: 1