Regular Expression Splitter 2
forked from Simple Console (diff: 7)
ActionScript3 source code
/**
* Copyright rfkrocktk ( http://wonderfl.net/user/rfkrocktk )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/mVun
*/
// forked from rfkrocktk's Simple Console
package {
import flash.text.TextFormat;
import flash.text.TextField;
import flash.display.Sprite;
public class RegExpSplitter extends Sprite {
private var textfield:TextField;
public function RegExpSplitter() {
this.textfield = new TextField();
this.textfield.x = this.textfield.y = 10;
this.textfield.width = this.stage.stageWidth;
this.textfield.height = this.stage.stageHeight;
this.textfield.defaultTextFormat = new TextFormat("Courier New");
this.addChild(this.textfield);
output("RegExp Splitter");
output("---------------------------");
output(new String("%d [%l] %abc{def} %(%another{} pattern) %2.0logger %20.20logger \% ")
.split(/((?<!\\)%(?:(?:\\-?[0-9]+)?\\.?(?:\\-?[0-9]+))?(?:[\w\.\-]+)?(?:\(.+?\))?(?:\{.+?\})?)/).join(""));
}
public function output(message:String):void {
this.textfield.appendText(message + "\n");
}
}
}
