Question on Group referecnes

5 views
Skip to first unread message

dcartier

unread,
Jan 2, 2012, 1:14:33 PM1/2/12
to UrlRewrite
I have run across what (I think ) is an odd situation. We have the
following rule below to handle some URL's that have double slashes
that are being condensed.

<urlrewrite decode-using="null">
<rule enabled="true">
<note>Normalize the double-slashes in REST urls</note>
<from>^(.+)$</from>
<to last="true">${replace:$1://:/_/}</to>
</rule>
</urlrewrite>

Everything works as expected until a URL (which I agree is poorly
chosen) like this is presented: .../$15,000-$25,000-price.html

This causes the $2 in the URL to attempt to match the second group and
throws 'java.lang.IndexOutOfBoundsException: No group 2'

I was unable to find the syntax that we are using '${replace:$1://:/
_/}' in the docs so it may be from a much older version so perhaps
there is a newer (and better) way of handling this?

Thanks,

Dennis
Reply all
Reply to author
Forward
0 new messages