porting JS XRegExp to AS3