[rt-users] Searching for a string

Bryon Baker bbaker at copesan.com
Fri Aug 9 12:15:01 EDT 2013


The single quote must have been a typo In the email.  I switch the code to use regex for the search see results below.  Using index still works just need to change brain thought to get it to work similar to regex.  I still think the issue is the double quotes in the content text.

I have done some other test using the Padre ide if I take out the double quotes the regex search works.

Here is the codes being used.

my $t_subject = $self->TransactionObj->ContentObj->Content ;
my $match = "Building: Walgreen Drug Store";
if ( $t_subject !~ /$match/i)  {
   $RT::Logger->debug("Found Match\n");
   return 0;
}
else {
   $RT::Logger->debug("No Match Found Match string: $match content: $t_subject\n");
   return 1;
}

Here is the log entry when the search fails and the content is in the log as well.

Thanks for the help

[Fri Aug  9 16:08:02 2013] [debug]: No Match Found Match string: Building: Walgreen Drug Store content: 

Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726  *  262-783-6261 ext. 2296
bbaker at copesan.com<mailto:cstephan at copesan.com>
www.copesan.com<http://www.copesan.com/>
"Servicing North America with Local Care"

From: Walgreens Facilities Maint Svc Ctr [mailto:walgreenshelp at cbre.com]
Sent: Thursday, July 18, 2013 9:26 AM
To: Client Service; Kimberly Jefferson
Subject: CSR- Dispatch of Work Order C2239243


The Walgreens Facilities Maintenance Svc Ctr has assigned a work order for service to Copesan Services Inc.

The referenced work order number is C2239243

Below are the details:


Date Entered: Jul 18 2013 9:22AM CST



Priority: P5 - Medium (5 Business Day Response)

Target Response: Jul 25 2013 9:22AM CST

Target Completion: Jul 25 2013 9:22AM CST



Service Location:

5600 W Fullerton, Chicago, IL, 60639-2305, US



Cntry, St, City: US, IL, Chicago-North Mkt

Building: Walgreen Drug Store #4233

Floor: All: 5600 W Fullerton

Area: Walgreen Drug Store #4233

Location within Area: (Not provided by Requestor)




Requestor Name: LAURA DWORAKOWSKI

Requestor Phone: 773-745-1640

Contact Name: LAURA DWORAKOWSKI

Contact Phone: (773) 637-4440




Problem Description: PEST CONTROL - NON EMERGENCY Insect/Rodent/Termite/Animal:>FLIES ARE EVERYWHERE IN THE STORE.

Order Status: O - Open



Cost of work should not exceed 300.00 USD.  If the cost of completing the work will exceed this amount please contact the Walgreens Facilities Maintenance Svc Ctr for approval/authorization before proceeding with the work.



If you have any questions about this work order, please contact the Walgreens Facilities Maintenance Svc Ctr at 877-871-3128




Notes to Vendor:

* To help ensure timely payment, please use the Vendor Activity Website to complete the order, providing arrival, departure and a description of work performed. Please use the Vendor Activity Website to submit detailed invoice information for billable services.

* Vendor shall adhere to all current safety regulations and standard company guidelines.

* Vendor shall be licensed, insured and bonded as required by regional/local laws where the work is being performed.

* In accordance with the financial terms of the FACILITIES MANAGEMENT OUTSOURCING SERVICES AGREEMENT by and between WALGREEN CO. and CBRE, Effective as of May 13, 2011, CBRE will be paying third party vendors according to Net 35 terms.  This is effective upon the assumption of existing or creation of new vendor relationships between CBRE and third party providers of goods and/or services to CBRE or WALGREENS on behalf of CBRE." ((eval 1542):8)
[Fri Aug  9 16:08:02 2013] [debug]: Committing scrip #15 on txn #1022 of ticket #96 (/usr/lib/perl5/vendor_perl/5.16.2/RT/Scrips.pm:182)
[Fri Aug  9 16:08:02 2013] [error]: Scrip 15 Commit failed: RT::Ticket::Body Unimplemented in RT::Action::UserDefined. ((eval 1549) line 12) 


Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726  •  262-783-6261 ext. 2296
bbaker at copesan.com
www.copesan.com
"Servicing North America with Local Care"

-----Original Message-----
From: rt-users-bounces at lists.bestpractical.com [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Nathan Cutler
Sent: Friday, August 09, 2013 8:28 AM
To: rt-users at lists.bestpractical.com
Subject: Re: [rt-users] Searching for a string

> I am searching the content of an email for a string using.
>
> m/'Building: Walgreen Drug Store #\d+/  Does not find text.
>
> But
>
> index($t_subject, 'Building: Walgreen Drug Store #'); Does find text.

A few (hopefully helpful) questions:

1. Why do have a single-quote character before the word Building in the first example, but not in the second?

2. Can you send an example string that you searching over?

3. Better yet, can you send a snippet of your code?

And a note: if you are trying to capture text, you need parentheses around the text you intend to capture. Something like this:

<CODE>
#!/usr/bin/perl
use strict;
use warnings;

my $str="And suddenly, there were Building: Walgreen Drug Store
#235232343434324235521 flies in the tepid air";

my ($substr) = ($str =~ m/(Building: Walgreen Drug Store #\d+)/); print $substr, "\n"; </CODE>

Also, you don't mention whether this string occurs only in the email headers, or also in the body? If in the body, will you have to deal with the possibility of a line break occuring inside the string?

Nathan



More information about the rt-users mailing list