Comment 136 for bug 134813

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

(From update of attachment 421240)
OK, but you can vastly simplify the code by using a better regular expression. E.g.:

<script>
function offsetToWord(data, offset) {
  var rest = data.substr(offset);
  var m = rest.match(/^\w+/);
  return m ? m : "";
}
function test(data, offset) {
  document.write("offsetToWord(\"" + data + "\"," + offset + ") = \"" + offsetToWord(data, offset) + "\"<br>");
}
test("hello kitty", 0);
test("hello kitty", 2);
test("hello kitty", 5);
test("hello kitty", 6);
test("hello kitty", 8);
</script>

Please revise the patch like that and then we can get this landed.