Browse Source

Lua: Ereg : matched group escapes must come before double dollar sign escapes

Justin Donaldson 9 years ago
parent
commit
4144a009a6
1 changed files with 1 additions and 1 deletions
  1. 1 1
      std/lua/_std/EReg.hx

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

@@ -114,8 +114,8 @@ class EReg {
 	}
 	}
 
 
 	public function replace( s : String, by : String ) : String {
 	public function replace( s : String, by : String ) : String {
-		by = Rex.gsub(by, "\\${2}", "$"); // escape double dollar signs
 		by = Rex.gsub(by, "\\$(\\d)", "%%1"); // convert dollar sign matched groups to Rex equivalent
 		by = Rex.gsub(by, "\\$(\\d)", "%%1"); // convert dollar sign matched groups to Rex equivalent
+		by = Rex.gsub(by, "\\${2}", "$"); // escape double dollar signs
 		return Rex.gsub(s,r,by, global ? null : 1);
 		return Rex.gsub(s,r,by, global ? null : 1);
 	}
 	}