Force the last index to be past the first matching position
package{ import flash.display.Sprite;
public class Main extends Sprite{ public function Main(){ var regex:RegExp = /b[a-z]{3}b/g; var sentence:String = "This string has two three letter words.";