Kayako logo
SupportSuite, eSupport and LiveResponse Discussion, troubleshooting and feedback related to Kayako's flagship support desk products SupportSuite, eSupport and LiveResponse.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  (#1) Old
richm Offline
Member
 
richm's Avatar
 
Posts: 387
Join Date: Jan 2007
Location: Orange County, CA
Mail parser post-parse regex to find word in subject? - 15-08-2007, 06:16 PM

I've tried any number of things trying to get this to work, and have had zero luck so I'll throw it out to the ever helpful community...
disclaimer: I'm a regex newbie... but I try.


Anyone know how to create a Mail parser post-parse regex to find a specific word in the ticket subject?

I'm looking to match:

alpha
Alpha
ALPHA

Basically I'm trying to match any occurrence (as a word, not as part of a word e.g not "alphabet") of the above strings irregardless of case.

...Now that I'm talking about this, I'm thinking we should start a thread of "regex examples that are known to work in esupport" as every time I try and create one, It seems to be a painful process (and all of the external testing apps I've used choke on things that end up working in esupport)


Rich


--
Features I need asap:
1) Ticket search in the client portal!
2) Column display in client portal showing clients email address or name
3) Downloads by client
(i.e. - each client has their own download area and can't see/touch downloads for any other client.) This would be on top of a "public" download area.
4) Integrated KB image uploads
The ability for staff to upload images with a KB articles.
Cheers!
   
Reply With Quote
  (#2) Old
richm Offline
Member
 
richm's Avatar
 
Posts: 387
Join Date: Jan 2007
Location: Orange County, CA
22-08-2007, 03:53 PM

Since there have been so many examples of working rules ... I thought I'd post the one that worked for me.

If you'll recall, I was looking to match any of the following words, anywhere in the subject line:

alpha
Alpha
ALPHA

Here's the expression I put together, that seems to work:

Quote:
/\b[Aa]lpha\b|\bALPHA\b/

One of the keys I've found so far is, the php implementation wants delimiters around the expression.

In this case I used forward slash "\" (first and last characters in the expression above.)

Here is the blurb on that from the docs:

Quote:
The syntax for patterns used in these functions closely resembles Perl. The expression should be enclosed in the delimiters, a forward slash (/), for example. Any character can be used for delimiter as long as it's not alphanumeric or backslash (\). If the delimiter character has to be used in the expression itself, it needs to be escaped by backslash. Since PHP 4.0.4, you can also use Perl-style (), {}, [], and <> matching delimiters. See Pattern Syntax for detailed explanation.
So, in theory at least (haven't had a chance to test it) the following would/should work also:

Quote:
[\b[Aa]lpha\b|\bALPHA\b]
{\b[Aa]lpha\b|\bALPHA\b}
(\b[Aa]lpha\b|\bALPHA\b)
<\b[Aa]lpha\b|\bALPHA\b>

So, taking my little example apart:
  • The "/" characters at the begining/end delimits the expression
  • The \b tags before and after the text you're searching for tell regex to search on word boundaries (whole words) so it will match the strings I listed, but should skip other occurrences of alpha when it's part of another word (like "alphabet")
  • The [Aa]lpha matches the strings "Alpha" or "alpha"
  • The "|" is an "or" (match the string before the "|" or match the string after the "|"
  • The last part simply matches "ALPHA" an all uppercase occurrence of alpha.


There is probably a more elegant way to do this, but I'm new to regex, so this is good enough for now I suppose.

HTH,

Rich

PS. The regex testers I've tried seem to choke on the word boundary and/or delimiter stuff.

PPS. I'm sure it would be helpful to the community if others posted creative examples they have found to work as well.


--
Features I need asap:
1) Ticket search in the client portal!
2) Column display in client portal showing clients email address or name
3) Downloads by client
(i.e. - each client has their own download area and can't see/touch downloads for any other client.) This would be on top of a "public" download area.
4) Integrated KB image uploads
The ability for staff to upload images with a KB articles.
Cheers!
   
Reply With Quote
Reply

Tags
parser, postparse, regex, subject, word

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Parser Turn it into a 'ticket' parser instead, and parse form ticket submits Jamie Edwards Feature Requests 0 11-06-2007 12:11 AM



Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vBulletin Skin developed by: vBStyles.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46