ExtractCustomField Regexp Help Needed

Hello,

I am using ExtractCustomField to try to populate some custom fields by
scanning for values in the body of the incoming message. My regexp
needs to match a starting string and then grab everything to the end
of the line. I have the regexp working with egrep in the bash shell,
but my custom fields aren’t being populated.

Here’s the output of the egrep command:
[dge@squidward ~]$ egrep ‘CSR Contact Name\s*([\w*|\s*])*’ CSRFile
CSR Contact Name Test Customer
[dge@squidward ~]$

Here’s the contents of CSRFile:
[dge@squidward ~]$ cat CSRFile
CSR Contact Name Test Customer
[dge@squidward ~]$

Here’s the relevant line of my CFExtract Template (#18):
Customer Name|body|CSR Contact Name\s*([\w*|\s*])*||

Here’s the contents of my Scrip (#16)
Description: CFExtract
Condition: On Create
Action: Extract Custom Field Values
Template: CFExtract
Stage: TransactionCreate

I do have one working that simply grabs a number from the subject
line, so I believe that the ExtractCustomField add-on is working
properly. Could some kind regexp/rt expert point me in the right
direction?

Thank you.

Darren

Darren Ellis
darren@mepad.net
Office: (207) 376-0137, x2201
Mobile: (207) 841-4000

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

I am using ExtractCustomField to try to populate some custom fields by
scanning for values in the body of the incoming message. My regexp
needs to match a starting string and then grab everything to the end
of the line. I have the regexp working with egrep in the bash shell,
but my custom fields aren’t being populated.

Darren,

I believe that the ExtractCustomField code is only able to inspect the email headers to look for matches. I don’t think it can look in the message body.

-Tim

Tim Wilson, Director of Technology
Buffalo-Hanover-Montrose Schools
214 1st Ave NE Buffalo, MN 55313
ph: 763.682.8740 fax: 763.682.8743 http://www.buffalo.k12.mn.us

I am using ExtractCustomField to try to populate some custom
fields by
scanning for values in the body of the incoming message. My regexp
needs to match a starting string and then grab everything to the end
of the line. I have the regexp working with egrep in the bash shell,
but my custom fields aren’t being populated.

Darren,

I believe that the ExtractCustomField code is only able to inspect
the email headers to look for matches. I don’t think it can look in
the message body.

Tim

It should look in the body without a problem. I’ve used it to parse
email bodies in the past.

Darren

The newer versions of ECFV are reasonably chatty when run with debug
logging.
What does it say about what it is trying to match against your regexp?

You may also want to test with perl instead of egrep.

perl -ne ‘print $1 if /CSR Contact Name\s*([\w*|\s*])*/’ CSRFile

For starters, I don’t think you really want | or * inside a character
class.

-kevin

Hello Darren,

for historic reason ECFV uses “|” as delimiter in the template. If you use
“|” in your regexp what you do the template will not behave as you might
expect.

You can redefine the separator ECFV uses by inserting a line at the
beginning of your scanner template, e.g.

Separator=<#>

then you write

Customer Name<#>body<#>CSR Contact Name\s*([\w*|\s*])*<#><#>

though I think you mean

Customer Name<#>body<#>CSR Contact Name\s*([\w\s]*)<#><#>

which will match “Test Customer” into your custom field.

You will need ECVF Version 1.1b2 or later to change the separator. Actual
version is 1.2b3
http://page.mi.fu-berlin.de/pape/rt3/ExtractCustomFieldValues.tgz

Regards,
Dirk.

–Am 31. Oktober 2007 21:47:33 -0400 schrieb Darren Ellis
darren@mepad.net:

Tim Wilson wrote:>>>> On Wed, Oct 31, 2007 at 8:47 PM, in message E9111BE9-3508-4D51-83BF-D4B32EDD3DDC@mepad.net, Darren Ellis darren@mepad.net wrote:

I am using ExtractCustomField to try to populate some custom fields by
scanning for values in the body of the incoming message. My regexp
needs to match a starting string and then grab everything to the end
of the line. I have the regexp working with egrep in the bash shell,
but my custom fields aren’t being populated.

Darren,

I believe that the ExtractCustomField code is only able to inspect the email headers to look for matches. I don’t think it can look in the message body.

Sure it can. Here’s my template for taking everything after ‘Host:’
(useful for Nagios alert)

Server|Body|Host:\s(.*)$||

One thing I notice is that the example and mine both have Body
capitalized, while the OP doesn’t. You might try changing that.
Maybe this would work (untested).

Customer Name|Body|CSR Contact Name\s*(.*)$||

Ryan

rfox.vcf (277 Bytes)