Posted By

hedgerwang on 11/16/10


Tagged

IE9


Versions (?)

IE9 Regex Bug


 / Published in: JavaScript
 

URL: IE_9_regex_bug

  1. <!doctype HTML>
  2. <html>
  3. <body>
  4. <pre>
  5. <script>
  6. var reg = /\%value\$/;
  7. var str = 'Price = %value$';
  8. document.writeln(str.replace(reg, '$9.99')); // Expect: Price = $9.99
  9. document.writeln(str.replace(reg, '$0.99')); // Expect: Price = $0.99
  10. document.writeln(str.replace(reg, '$0.00')); // Expect: Price = $0.00
  11. </script>
  12. Expected Result:
  13. Price = $9.99
  14. Price = $0.99
  15. $0.00
  16.  
  17. Actual result on IE9:
  18. $9.00
  19. %value%.99
  20. %value%.00
  21.  
  22. </pre>
  23.  
  24. </body>
  25. </html>

Report this snippet  

You need to login to post a comment.