Created attachment 105522 [details] Contains test HTML and Screenshots of output. Elias Zamaria has discovered a bug in the regular-expression processing of the webkit that runs inside the UIWebView on an iPhone 4 running iOS 4.3.3 (8J2). The user-agent string of such a UIWebView is: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8J2 The bug presents in the following manner: iOS 4.3.3 UIWebView: PRESENTS: iOS-4_3_3-UIWebView.png iOS 4.3.3 Safari: DOES NOT PRESENT: iOS-4_3_3-Safari.png MacOS Safari 5.1 (6534.50): DOES NOT PRESENT: MacOS-Safari-5_1.jpg We believe the iOS 4.3.3 UIWebView case to be INCORRECT output. Whereas the other cases are correct. Steps to reproduce: Load http://eliasz.net/regexTest.html using a UIWebView. Alternatively, regexTest.html can be found in the zipfile attached to this bug. To be explicit, the test code is this: <!DOCTYPE html> <html><head> <title>regex test</title> </head> <body> <div id="test"></div> <script>document.getElementById("test").innerText = "stuff/oldSubstr".replace(/[^\/]*?$/, "replacement");</script> </body></html> It is expected that "oldSubstr" be replaced with "replacement." This does not happen in the UIWebView case (the replacement string is instead appended to the end). All of the above-mentioned files have all been incorporated into the attached regexTest.zip. Could this bug be related to: https://bugs.webkit.org/show_bug.cgi?id=23121 ?
Please don't report iOS specific bugs here, http://bugreport.apple.com is the correct place for that.
Even though this report is ostensibly about UIWebView, I suspect it comes down to a bug in JavaScriptCore's regular expression interpreter. My guess is that the same bug is reproducible on PPC in Safari, too, or if you modify the expression to add complex capturing. Anyone out there have a PPC box they can test with? :)
<rdar://problem/10043693>
This bug should be fixed in iOS 5.0 or later, please reopen if you can still reproduce this issue. thanks!, G.