|
![]() |
| | LinkBack (1) | Thread Tools | Search this Thread | Rate Thread | Display Modes |
(#1)
|
(#2)
|
| Member Posts: 81 Join Date: Jan 2007 |
26-12-2007, 06:31 PM
Nevermind... for anyone interested here yah go. When entering the breakline make sure it begins with / as this triggers it to do a regex compare. /modules/parser/functions_parsercore.php Replace: Code: function processBreakLines($content)
{
global $_SWIFT;
parserDebug("NOTICE: Processing Breaklines");
$breakline = &$_SWIFT["breaklinecache"];
parserDebug("NOTICE: Breakline Total: ".count($breakline));
if (!is_array($breakline))
{
parserDebug("NOTICE: No Breaklines found!");
return $content;
}
foreach ($breakline as $key=>$val)
{
parserDebug("NOTICE: Processing Breakline: ".$val);
$breakcontent = reversestrchr($content, $val);
if ($breakcontent)
{
parserDebug("NOTICE: Breakline Triggered!");
// Eureaka! Eureaka! Eureaka!
return $breakcontent;
}
}
return $content;
} Code: function processBreakLines($content)
{
global $_SWIFT;
parserDebug("NOTICE: Processing Breaklines");
$breakline = &$_SWIFT["breaklinecache"];
parserDebug("NOTICE: Breakline Total: ".count($breakline));
if (!is_array($breakline))
{
parserDebug("NOTICE: No Breaklines found!");
return $content;
}
foreach ($breakline as $key=>$val)
{
parserDebug("NOTICE: Processing Breakline: ".$val);
if(substr($val,0,1) == '/') {
$splits = preg_split($val,$content);
$breakcontent = count($splits) ? $splits[0] : false;
} else {
$breakcontent = reversestrchr($content, $val);
}
if ($breakcontent)
{
parserDebug("NOTICE: Breakline Triggered!");
// Eureaka! Eureaka! Eureaka!
return $breakcontent;
}
}
return $content;
} |
| | |
(#3)
|
| Operations Manager |
26-12-2007, 06:38 PM
Hi atDev, So this modification will work with and without regular expressions entered as breaklines? -------------------------------------------------------------------
|
| | |
(#4)
|
(#5)
|
| Member Posts: 81 Join Date: Jan 2007 |
26-12-2007, 07:07 PM
As far as implementing this in the core kayako code, I would tell your developers to use solution #2 as you are going to be comparing a string versus the email content no matter what. preg_split will work even if its given a static string (no regex) but it may be a bit slower. It is either that or do an if/else statement like I did in #1 solution above. |
| | |
(#6)
|
| Operations Manager |
26-12-2007, 07:10 PM
Hi atDev, Thanks a lot for sharing this - we will be implementing a regex solution soon. I have split your posts to a new thread here. -------------------------------------------------------------------
|
| | |
(#7)
|
(#8)
|
| Member Posts: 81 Join Date: Jan 2007 |
27-12-2007, 11:06 PM
For anyone needing them. After reviewing some more emails not getting parsed we have added these three regex lines to catch variations of the breakline: /On [0-9]{1,2}\/[0-9]{1,2}\/[0-9]{1,2},(.)+ <(.)+@(.)+> wrote:/ /On [A-Za-z]{3} [0-9]{1,2}, at [0-9]{1,2}:[0-9]{2} (PM|AM), (.)+ wrote:/ /On [A-Za-z]{3} [0-9]{1,2}, [0-9]{4} [0-9]{1,2}:[0-9]{2} (PM|AM), (.)+ <(.)+@(.)+> wrote:/ |
| | |
(#9)
|
| Member Posts: 81 Join Date: Jan 2007 |
28-12-2007, 04:05 AM
A bugfix. It appears preg_split returns the entire string if no splits are done, which in theory it should. This causes it to no parse/run through the rest of the breaklines. I switched to using this: Code: foreach ($breakline as $key=>$val)
{
parserDebug("NOTICE: Processing Breakline: ".$val);
if(substr($val,0,1) == '/') {
$breakcontent = preg_match($val, $content, $matches, PREG_OFFSET_CAPTURE) ? substr($content,0,$matches[0][1]) : false;
} else {
$breakcontent = reversestrchr($content, $val);
}
if ($breakcontent)
{
parserDebug("NOTICE: Breakline Triggered!");
// Eureaka! Eureaka! Eureaka!
return $breakcontent;
}
} |
| | |
(#10)
|
| New Member Posts: 2 Join Date: Feb 2008 eSupport Yearly Leased License |
24-02-2008, 03:14 PM
Hi, I would like to implement this in my support site, but I have a leased eSupport and the source is zend-encoded, is there any way to obtain the same zend-encoded file with this change on it? Thanks! Maykel Rodriguez SpeedyRails - Celebrating our First Anniversary! |
| | |
(#11)
|
| Senior Member Posts: 4,951 Join Date: Jun 2005 Location: Cumbria, UK SupportSuite Owned License |
24-02-2008, 03:22 PM
You need to contact Jamie (jamie.edwards<!at!>kayako<!dot!>com) listing the files you need and he will be able to provide. Icon Headquarters - Its Elixir - Web2Messenger |
| | |
(#12)
|
| Operations Manager |
24-02-2008, 06:43 PM
Hi Maykel, Unfortunatly the open files are unable on your leased license; in order to have near-unrestricted access to the source code (except for the licensing functions), you need to have an owned license. -------------------------------------------------------------------
|
| | |
(#13)
|
| Senior Member Posts: 4,951 Join Date: Jun 2005 Location: Cumbria, UK SupportSuite Owned License |
24-02-2008, 08:04 PM
I thought you were able to request individual files and get them unencoded? Icon Headquarters - Its Elixir - Web2Messenger |
| | |
(#14)
|
| Chief Operating Officer Posts: 789 Join Date: May 2005 Location: Boise, Idaho |
17-04-2008, 06:43 PM
I've committed this feature to CVS as of today. Breaklines that are to be treated as a regular expression start with "regex:" and must contain the start/stop symbols of a normal regex; (e.g. "regex:@[abcd]@") -------------------------------------------------------------------
|
| | |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
| |
LinkBacks (?)
LinkBack to this Thread: http://forums.kayako.com/f52/regular-expressions-breaklines-regex-14950/ | ||||
| Posted By | For | Type | Date | |
| Kayako Bug Tracker - Viewing Bug #418 - Regular expressions for breaklines (regex) | This thread | Refback | 26-12-2007 07:13 PM | |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mail parser -> Rules and regular expressions for headers | AllanMar | Will Implement (V4) | 4 | 11-04-2008 03:30 PM |
| Regex validation and custom fields (how to make it work?) | richm | SupportSuite, eSupport and LiveResponse | 8 | 24-12-2007 11:19 PM |
| Mail parser post-parse regex to find word in subject? | richm | SupportSuite, eSupport and LiveResponse | 1 | 22-08-2007 03:53 PM |
| Built in regex tester | richm | Will Implement (V4) | 2 | 15-08-2007 05:57 PM |
Kayako provides online help desk software and support solutions; enabling companies to improve their support and reduce costs.
Our three main products include: SupportSuite, eSupport and LiveResponse