ソースを参照

bugfix for 1-character capture groups in EReg.replace

mockey 10 年 前
コミット
482a97b510
1 ファイル変更1 行追加1 行削除
  1. 1 1
      std/php/_std/EReg.hx

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

@@ -90,7 +90,7 @@
 	public function replace( s : String, by : String ) : String {
 		by = untyped __call__("str_replace", "\\$", "\\\\$", by);
 		by = untyped __call__("str_replace", "$$", "\\$", by);
-		untyped __php__("if(!preg_match('/\\\\([^?].+?\\\\)/', $this->re)) $by = preg_replace('/\\$(\\d+)/', '\\\\\\$\\1', $by)");
+		untyped __php__("if(!preg_match('/\\\\([^?].*?\\\\)/', $this->re)) $by = preg_replace('/\\$(\\d+)/', '\\\\\\$\\1', $by)");
 		return untyped __call__("preg_replace", re, by, s, global ? -1 : 1);
 	}