IndexOutOfBoundsException with Catalina SSI Servlet

I played around with some Server Side Includes using org.apache.catalina.ssi.SSIServlet and noticed that some statements (which were fine on Apache) are not working on GlassFish. Finally I found the solution.

In Apache (using mod_ssi) you can do this:

<!--#if expr="{$HTTP_USER_AGENT} == /(iPhone)/" -->
<p>It's an iPhone.</p>
<!--#endif -->

But on GlassFish Server (with SSIServlet) you have to do this:

<!--#if expr="{$HTTP_USER_AGENT} = '/(iPad)/'" -->
<p>It's an iPhone.</p>
<!--#endif -->