ArrayIndexOutOfBoundsException while evaluating regular expression
After upgrading from Saxon 9.4 to 9.6, a regular expression that worked
fine suddenly throws a java.lang.ArrayIndexOutOfBoundsException.
The expression attempts to normalize space between numbers and selected
SI units. Below is a stylesheet that isolates the problem.
<test> <xsl:value-of select=" replace('30 dB',' ([0-9])\s+ ( ( [hkMGTPdcmµnpf]?([mgsAKNJWCVFSTHLl]) | ([ch]a|t|dB) | ((k|Ki|[MGTP]i?)?(B|bit)) | (KB?) ) (\W|$) ) ','$1 $2','x')" /> </test>
I tested it in oXygen 15.2 using Saxon-PE 188.8.131.52 and with several
version of Saxon 9.6 and 9.7 for .NET on Windows 7.
It works fine in Saxon 9.4, it also works fine in 9.5 and 9.6/7 when
using the native regex engine with flags "!" resp. ";j" or ";n". So I
guess it has something to do with the new Jakarta-based regex
implementation introduced in 9.5.
The error only occurs when there is a match.
Could it be a bug, or is the regular expression invalid (or simply too
horrible to be processed by decent regex matchers)?
Tom De Herdt
Please register to edit this issue