I disagree that a rollback was needed.
While the change may appear to be drastic, in the end it's only superficial and an improvement for the answer. I don't believe you need a gold badge in JavaScript to see the answer is the same before and after the edit, nor even a lot of JavaScript experience.
The answer's code remains the same:
url.match(/.*\/\#inbox\//)[0]
The only thing that the edit made was to surround that snippet with an actual example of use, while preserving the author's intention.
It added to the answer, without changing its core. Edits in answers are fine for this: improve without change. The post author is free to rollback if disagrees with the edit, no need to make the decision for them.
// Complete url
var url = 'http://test.example.com/#inbox/U2FsdGVkX19stSSdMXLZq5v7bOgzRLtaM7Lr1t+lWpI=';
var desiredResult = url.match(/.*\/\#inbox\//)[0];
console.log(desiredResult.substring(0, desiredResult.length - 1)); // this will output 'http://test.example.com/#inbox'
Rolling back that edit destroys value and preserves nothing. A new answer that simply included the same code plus the extra examples added no needed value. If questions like this are going to get answers, let's at least not answer multiple times the same thing.
It's great that this user chose to help instead of simply reposting. Edits are not reserved to correct spelling and formatting. Fixing and improving answers (while preserving the original intent) is a great use of edits.
Some past discussions about this, in no particular order:
While there is a lot of "it depends" on most of these discussions, I see no clear "touching code is inherently bad" in most answers to these. I tend to read: "It can be good and acceptable in some cases", and not "do not ever interfere with code".
The actual discussion here is: was it good in this case, or was it wrong? If if was wrong, why was it wrong? I can't see any harm done by the edit, and clear benefits. It's a user doing something good for the community, instead of posting yet another one-liner for teh pointz.
(I find it hard to believe that the question didn't need to be closed as a dupe, but that's a different matter)