It's not replaceAll vs. replaceFirst, it's replace recursively or not.
For me, it should not be recursive (independently of the q flag, I agree
with you Jim).
Actually, if it is recursive, it should be a never-ending replacement in
this case, which would be a (not voluntary) denial of service. I do not
expect this.
Nick
Jim Jagielski wrote:
On Mar 11, 2009, at 5:03 AM, Nick Gearls wrote:
Oops, stupid !
Anyway, a real problem:
Substitute s|(toreplace)|*replaced[$1]*|qi
translates "toreplace" into
"*replaced[*replaced[*replaced[toreplace]*]*]*"
Don't we expect the q flag to stop any replacement after the first one?
Not necessarily, no... it's not a replaceAll vs. replaceFirst
flag.