Maybe you can also use Groovy, as with jelly is likely harder to do something like that.
The sample that is included as part of email-ext here does something like that with Groovy, i.e. it retrieves the last 100 lines of build output and then uses StringEscapeUtils on each line to ensure that the text is not interpreted as HTML:
<% build.getLog(100).each() { line -> %>
<TR><TD class="console">${org.apache.commons.lang.StringEscapeUtils.escapeHtml(line)}</TD></TR>
<% } %>
instead of the escaping, you could do some decision and only output stuff if the condition holds, e.g.
${if(line.contains('mytext')) { // do stuff here }}