Unexpected results with JavaScript regexp method - help

In a Servoy method I wanted to use the JavaScript method exec() with the global flag to check the position of certain characters inside Italian addresses.

After many experiments with no success, I discovered that exec() used inside a Servoy method doesn’t return the value of lastIndex, but gives instead an undefined value, although it correctly finds all the searched substrings.

This is the JavaScript used in Servoy (the string for var testo is just a test, it has no meaning)

var testo = "ca' dei buoi de' romani di ca' bembo"
var cade = new RegExp("^ca\\'\\s|\\w\\sca\\'|\\w\\sde'\\s","g");
var apostrofo = new RegExp("[aeiou]\\'","g");
var exCaDe = new Array();
var exApostrofo = new Array();
var dial01,dial02,dial03,dial04,dial05,dial06;

for(var q = 1; q <= 3; q++)
{
	exCaDe = cade.exec(testo);
	dial01 = "Pos "+q+"\nexCaDe "+exCaDe[0];
	dial02 = " Index"+exCaDe.index;
	dial03 = " LastIndex "+exCaDe.lastIndex+" /";

	exApostrofo = apostrofo.exec(testo);
	dial04 = " exApostrofo "+exApostrofo[0];
	dial05 = " Index "+exApostrofo.index;
	dial06 = " LastIndex "+exApostrofo.lastIndex;

	var bottone = plugins.dialogs.showInfoDialog("",    dial01+dial02+dial03+"\n"+dial04+dial05+dial06,"Ok", "Continue");
	if(bottone == "Continue")
	continue;
}

I tried the same script with IE: on Windows 2000 it gives the expected results, while on MacOS both the Index and lastIndex values are correct, the substrings searched are incorrect.

I don’t need an alternative method, I already figured out a different one. I just wanted to know whether I am doing anyting wrong or if the problem is the Servoy implementation of JavaScript.

This behaviour can be reproduced both on Windows and MacOs 10.4 using Servoy 2.2.1rc build 330

regexp