/ Published in: JavaScript
URL: IE_9_regex_bug
Expand |
Embed | Plain Text
<!doctype HTML> <html> <body> <pre> <script> var reg = /\%value\$/; var str = 'Price = %value$'; document.writeln(str.replace(reg, '$9.99')); // Expect: Price = $9.99 document.writeln(str.replace(reg, '$0.99')); // Expect: Price = $0.99 document.writeln(str.replace(reg, '$0.00')); // Expect: Price = $0.00 </script> Expected Result: Price = $9.99 Price = $0.99 $0.00 Actual result on IE9: $9.00 %value%.99 %value%.00 </pre> </body> </html>
You need to login to post a comment.
