oarevalo / BugLogHQ

BugLogHQ is a tool to centralize the handling of automated bug reports from multiple applications. BugLogHQ provides a unified view of error messages sent from any number of applications, allowing the developer to search, graph, forward, and explore the bug reports submitted by the applications.
http://www.bugloghq.com
155 stars 67 forks source link

Issues Using RegEx Inside SendToJira.cfm file #149

Open pmolaro opened 7 years ago

pmolaro commented 7 years ago

I'm in the process of customizing my /hq/views/SendToJira.cfm file to add a few more details that my team uses. I'm trying to scrap a few pieces of info from the htmlReport result (oEntry.getHTMLReport()). I have copied a result block into a sandbox file and setup some regex calls to grab and format the data I want. However, when I plug this into my SendToJira.cfm file the same code does't work.

For example, we want the URL, and the tag context. So I have this code:

// get Tag Context
tagContext = REMatchNoCase("<li>.+?(?=</td>)", htmlReport);
tagContextForDisplay="";

if(arrayLen(tagContext)){
    tagContextForDisplay = ReplaceNoCase(tagContext[1],"<li>","* ","all");
    tagContextForDisplay = ReplaceNoCase(tagContextForDisplay,"</li>","","all");
}

//get URL
urlValue = REMatch("<b>URL.+?(?=_blank)", htmlReport);
urlfForDisplay="";

if(arrayLen(urlValue)){
    urlfForDisplay = ReplaceNoCase(urlValue[1],'<b>URL:</b></td> <td><a href="','','all');
    urlfForDisplay = ReplaceNoCase(urlfForDisplay,'" target="','','all');
    urlfForDisplay = "*URL:* [" & urlfForDisplay & "]";
}

// Tag Context Result should be something like:
* /frameworks/fw1/v3_5/framework/one.cfc [1412] * /frameworks/fw1/v3_5/framework/one.cfc [816] 

// URL Result should be something like:
*URL:* [http://www.somesite.com:80/index.cfm?action=events:show.saveUpdate]

When I drop this into my SendToJira.cfm file the result of the REMatch() is an empty array. The only difference in my sandbox file is I have the htmlReport result in a SaveContent block.

Any know issues with the code, Railo, etc that would cause REMatch() to not work the same here as it does for me locally?