Pages: 1
RSS
%SETPATTREGEXP...REGEXPMATCH="%TEXT" - please help
 
Hello!

I have a webform which brings me e-mails that have the same layout. I am trying to make a reply template that utilises some fields from original messages. For example in text:
-----------------
transport do: Rzuchow k.Raciborza
wyrob: swieczka
-----------------
"transport do:" is static,
"Rzuchow k.Raciborza" is the text entered by the clent. I would like to utilize that text. I understand I should use something like:

%SETPATTREGEXP="transport do:____"%REGEXPMATCH="%TEXT"

but I have no luck with switches that should be placed in "____". Please help! :-)

Ernest
 
Try this

%SetPattRegExp="(?is)(.*?)transport\sdo:\s(.*?)\n"%-
%RegExpBlindMatch="%Text"%-
%SubPatt="2"
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Thank you! It works great!

:D  
 
Seems like this would be a pretty powerful function.. is there a maximum number of searches you can do in a message with one template?
 
No there is no limit. Templates are processed serially, like a program.
iviarck
 
Makes sense.. though, how would you gather a bunch of numbers from the original message and assign them to variables if you wanted to perform some calculations on them first and then display the results?
 
Here's the thing..

I've been developing some very specific eBay templates for an automation project I'm working on and I think The Bat! could fit the bill nicely.  My goal is to eventually discuss the possibility of a reseller account for The Bat! with you guys and incorporate my templates as a package deal to end-users of eBay.

There were some roadblocks along the way but the main 'show-stopper' is due to the possible limitations of regexp...

I imagine pulling numbers out of *one* email and performing calculations is possible (how?!).. but I'd also need to extract specific text and values from *multiple* emails -- based on a filter.

ie. a reply template that pulls specific data from all messages with the same username in them, then calculates totals and (only if it found any data), puts it into the reply message.  This would be an invoice for multiple eBay item winnings, but it'd also shed light on the rest of the project and determine whether The Bat! is the solution for this or not.
 
Marck, is regexp/MyMacros capable of doing something like this?

 
Hmmm.

Not so easy.

You could use the filter to pump the bunch of messages out to an export file using "append" options then create a new message in a final clean up filter that can use regexp to assign values to variables

%_var=#%regexpmatch="%include='expfile.txt'"#

or even

%_text=-"%include='expfile.txt'"%-
%setpattregexp="....."%-
%_var1="%regexpmatch(%_text)"%-

and finally use %calc="%_var1*%_var2" etc to do the final summations.
iviarck
 
Hi Marck,

Yep, I think that would work.. except now I think there are too many varying factors in this case to truly automate invoicing for multiple winning bidders at once.  I'm not sure how I can use filter/regexp to search for common (unknown) text (the winning bidder's name, whatever it happens to be) in a group of messages that have arrived over a period of time.  

For example:

20 (or more) auctions close at different times (say, every 5-10 minutes over a period of 45 minutes or so).  That results in sporadic incoming "congrats/item sold to user: xxxx" emails.  First question is how to know when to start filtering/exporting and when to end?  I suppose by clicking 're-filter' on some selected messages is the only way for that, first by manually selecting the message for each multiple-winning bidder, one-by-one?

If there IS some way of using automated filters, it'd eliminate having to manually select messages, etc.  In this example, out of those 20 auctions, 10 of the items may be sold to different winners but the remaining winners may have won 2 or 3 items each (multiple auction winners).  Since you never can know the specific names of the winners to filter on, how would you filter based on "like data" in order to export each winner and perform *separate* calculations for each of those corresponding winners in a single file?  Are you saying to filter using 'Text' 'matches all as RegExp' and export to a file?

Maybe I'm expecting too much from the Bat?  Or maybe I need some sleep first... ;)
 
Well, you can use the scheduler to periodically refilter a specific folder.

One of the filter actions is "Export message to " with an option of "Plain text" and "Append to existing file". This will extract the body text into a bulk text without the need to use regex.

Next you need to process the summary mail. Again, a scheduled even a moment later can create a new message and using the %_bulk='%include="exported.txt"' macro grab a copy of the exported bulk text to be processed by regexp extractions.

By clever use of recursive quick templates will allow you to pluck out names sequentially and summarise the details for each (see the Macro library on the FAQ web site for examples at http://www.silverstones.com/thebat/Library.html - the re-wrap stuff is quite clever. Well - the MySQL server seems to be having trouble. But it will be back eventually).

Hmm - this is non-trivial, isn't it. The problem is that you need to group the output by customer and generate a new outbound message for each. There may be something in one of the macro plugins to help here - I don't know. Running out of steam rapidly.

iviarck
 
Hi everybody,

I have the same problem as Ernest (see top page).
I'm using webforms and want a reply template that can copy a specific field to the address field.

example:
-----------------
e-mail1: Test@testing.com
-----------------

"e-mail1:" is static,
"Test@testing.com" is the text entered by the clent.

Bye Michael
 
Hi everybody,

I have about the same problem and the about same solution.

Since I do not exactly have
"transport do: Rzuchow k.Raciborza"

but insted something like

"transport do:     Rzuchow k.Raciborza"
        note the 5 spaces)

I have to use the folowing template:

%SETPATTREGEXP="(?i-s)^transport\sdo:\s(.*)$|\z"%-
%REGEXPBLINDMATCH="%text"%-
%SUBPATT="1"%-

it as allways worked but now that I am try the new "The BAT"
I do not get with "%REGEXPBLINDMATCH="%text"%-" as usual the answer "Rzuchow k.Raciborza"

but "     Rzuchow k.Raciborza" with the 5 spaces that I do not need at all  :|

does anybody know how can I get ride of these 5 spaces?

Since I am not the owner of the form I can not change it...

thanks a lot in advance  
 
Micheal,

Try this in your template:

%SetPattRegExp="(?is)(.*?­)e-mail1:\s(.*?)\n"­%-
%RegExpBlindMatch="%Text"­%-
%To=''%To='%SubPatt="2"'%-
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Lemo Nico,

Try substituting the \s with (\s*?)
That probably makes it necessary to change the %subpatt='1' to %subpatt='2'

So you'd get this:

%SETPATTREGEXP="(?i-s)^tr­ansport\sdo:(\s*?)(.*)$|\z"%-­
%REGEXPBLINDMATCH="%text"­%-
%SUBPATT="2"%-

__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Hello dear Bat´s God

I still searching a solution for my problem of spaces in field that I try to recognise and delete, the good new is that I understand why I did not managed to remplace the different spaces till now. In fact these are not spaces but tabs (tabulations) and they look like spaces:

this is my first exemple 1 :____Rzuchow k.Raciborza
this is the second 2 :________Raciborza ґs brother
and the third 3 :____________sister of Raciborza  

the ___ are my tabs that the bat change in spaces ...  ( I hate them  ;) )

Does anyone know how to recognise tabs in forms in order to get ride of them ?

in fact this is very important for me because I use the bat in order to export some addresses in a .txt file that I have to import on Internet in order to prepare the labels for the post shipment.

Please help
Edited: lemo nico - 07 February 2009 16:07:49
Pages: 1