|
@@ -32,17 +32,22 @@ class EReg {
|
|
|
var s : String; // the last matched string
|
|
|
var m : Table<Int,Int>; // the [start:Int, end:Int, and submatches:String (matched groups)] as a single table.
|
|
|
|
|
|
+ static var FLAGS: Table<String, Int>; // Available PCRE flags
|
|
|
+
|
|
|
public function new( r : String, opt : String ) : Void {
|
|
|
- var ropt = new StringBuf();
|
|
|
+ var ropt = 0;
|
|
|
for (i in 0...opt.length){
|
|
|
switch(opt.charAt(i)){
|
|
|
- case "i", "m", "s" : ropt.add(opt.charAt(i));
|
|
|
+ case "i" : ropt |= FLAGS.CASELESS;
|
|
|
+ case "m" : ropt |= FLAGS.MULTILINE;
|
|
|
+ case "s" : ropt |= FLAGS.DOTALL;
|
|
|
+ case "u" : ropt |= FLAGS.UTF8;
|
|
|
case "g" : global = true;
|
|
|
default : null;
|
|
|
}
|
|
|
}
|
|
|
if (global == null) global = false;
|
|
|
- this.r = Rex.create(r, ropt.toString());
|
|
|
+ this.r = Rex.create(r, ropt);
|
|
|
}
|
|
|
|
|
|
public function match( s : String ) : Bool {
|
|
@@ -152,6 +157,7 @@ class EReg {
|
|
|
if (Rex == null){
|
|
|
throw "Rex is missing. Please install lrexlib-pcre.";
|
|
|
}
|
|
|
+ FLAGS = Rex.flags();
|
|
|
}
|
|
|
|
|
|
}
|