StDoodle
Minion
Ok, I could be wrong, and stupid, it's all happened before.
But it appears that there's a java bug involving having a dollar sign in the replacement text that shows in ash when using replace_all() or replace_first().
To test, try this:
Now, we can get around this by replacing all dollar signs (using the matcher "\\$") and replacing them with "\\\$" and then they'll be properly escaped once they're actually used in a write() call, but we'll still see the backslash on a print().
Any thoughts on a general solution that doesn't involve changing a string around based on where it's going would be appreciated. Or feel to point out something that should be obvious that I'm missing; that's entirely possible.
But it appears that there's a java bug involving having a dollar sign in the replacement text that shows in ash when using replace_all() or replace_first().
To test, try this:
Code:
void main() {
string s = "hello$folks";
matcher m = create_matcher("h(.+?)s",s);
if (m.find()) s = replace_all(m, "BOB" + m.group(1) + "BOB");
}
Now, we can get around this by replacing all dollar signs (using the matcher "\\$") and replacing them with "\\\$" and then they'll be properly escaped once they're actually used in a write() call, but we'll still see the backslash on a print().
Any thoughts on a general solution that doesn't involve changing a string around based on where it's going would be appreciated. Or feel to point out something that should be obvious that I'm missing; that's entirely possible.
Last edited by a moderator: