纯Haxe实现的正则表达式引擎:HxRE
jopen
9年前
HxRE是一个纯Haxe实现的正则表达式引擎。
这个库基于 libregex.
Haxe's macro facility is used to provide compile-time specialization of the regex virtual machine.
Usage
@:build(hxre.Specializer.build("(\\d{4})-(\\d{2})-(\\d{2})")) class SpecialRegex extends hxre.NfaVM {} class Main { public static function main() { // dynamic compiled regex var re = new hxre.Regex("(\\d{2}):(\\d{2})"); trace(re.exec("2014-11-20T12:00Z")); // static compiled regex trace(SpecialRegex.regex.exec("Date: 2014-11-30")); // static regex is also able to create new instances var sre : hxre.Regex = new SpecialRegex(); trace(sre.exec("2014-12-31T12:00Z")); } }