Dear Monks

I am writing a script for Resource Tracker to look for specific key words in a email subject and send them to different queue name

.

This script below works for single search word, but i wanted to use multiple key word

Custom Action Preparation code

my $match = (".*SSL.*"|".*SSL Certificate.*"|".*VASCO.*"); my $t_subject = $self->TicketObj->Subject; if ( $t_subject !~ /$match/i ) { return 0; } else { return 1; }

Custom action clean up code

my $newqueue = "Key Management"; my $T_Obj = $self->TicketObj; $RT::Logger->info("Auto assign ticket #". $T_Obj->id ." to queue #". $ +newqueue ); my ($status, $msg) = $T_Obj->SetQueue($newqueue); unless ($status) { $RT::Logger->warning("unable to set new queue: $msg"); return undef; } return 1;

Issue

Here the issue is with the $match, the script works when i have only one key word. Say if i have more than one key word (in this instance SSL, SSL Certificates, Vasco)then the script is not working.

Is there any alternate way i can follow to overcome this

Can any one please help me out with this??, Please

Thanks


In reply to Regex to match multiple words in an email subject by brainfold

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.