Browse Source

bugfix in replace with $X optional

Nicolas Cannasse 15 years ago
parent
commit
7c2f7b6ed6
1 changed files with 3 additions and 3 deletions
  1. 3 3
      std/neko/_std/EReg.hx

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

@@ -118,9 +118,9 @@
 					if( p == null ){
 						b.add("$");
 						b.add(k);
-					}else{
-					b.addSub(s,p.pos,p.len);
-					b.addSub(k,1,k.length - 1);
+					} else {
+						if( p.pos >= 0 ) b.addSub(s,p.pos,p.len);
+						b.addSub(k,1,k.length - 1);
 					}
 				} else if( c == null ) {
 					b.add("$");