Browse Source

fixed previous fix

Franco Ponticelli 13 years ago
parent
commit
11a44fc85e
1 changed files with 3 additions and 3 deletions
  1. 3 3
      std/php/_std/EReg.hx

+ 3 - 3
std/php/_std/EReg.hx

@@ -33,6 +33,8 @@
 	var re : String;
 	var re : String;
 	var matches : ArrayAccess<Dynamic>;
 	var matches : ArrayAccess<Dynamic>;
 
 
+	static var QUOTE : String = untyped __call__("preg_quote", "/", "/");
+	
 	public function new( r : String, opt : String ) : Void {
 	public function new( r : String, opt : String ) : Void {
 		this.pattern = r;
 		this.pattern = r;
 		var a = opt.split("g");
 		var a = opt.split("g");
@@ -40,9 +42,7 @@
 		if( global )
 		if( global )
 			opt = a.join("");
 			opt = a.join("");
 		this.options = opt;
 		this.options = opt;
-		var p : String = untyped __call__("str_replace", "/", "\\/", r);
-		p = untyped __call__("str_replace", "\\\\/", "\\\\\\/", p);
-		this.re = "/" + p + "/" + opt;
+		this.re = untyped __php__("'\"' . str_replace('\"','\\\\\"',$r) . '\"' . $opt");
 	}
 	}
 
 
 	public function match( s : String ) : Bool {
 	public function match( s : String ) : Bool {