Z
Zwerfkat
When running the code below, all browsers are showing "Hello World" except Safari which cannot match
the regular expression. See also http://www.testabc.nl/safari/test.html
When I change [^A]*? into .*? or add a space at the end of the string Safari is working alright
again.
I guess this is a bug in Safari Javascript, or?
<html>
<head>
<script language=JavaScript type=text/javascript>
var reg_date = /(Hello[^A]*?)\s*$/;
var str = 'Start: Hello world';
function show()
{
if(str.search(reg_date) != -1) alert(RegExp.$1);
else alert ("No match...");
}
</script>
</head>
<body>
<h3>Javascript code:</h3>
<div>var reg_date = /(Hello[^A]*?)\s*$/;</div>
<div>var str = 'Start: Hello world';</div>
<div>if(str.search(reg_date) != -1) alert(RegExp.$1);</div>
<div> else alert ("No match...");</div>
<p><button onclick="show();">start</button></p>
</body>
</html>
the regular expression. See also http://www.testabc.nl/safari/test.html
When I change [^A]*? into .*? or add a space at the end of the string Safari is working alright
again.
I guess this is a bug in Safari Javascript, or?
<html>
<head>
<script language=JavaScript type=text/javascript>
var reg_date = /(Hello[^A]*?)\s*$/;
var str = 'Start: Hello world';
function show()
{
if(str.search(reg_date) != -1) alert(RegExp.$1);
else alert ("No match...");
}
</script>
</head>
<body>
<h3>Javascript code:</h3>
<div>var reg_date = /(Hello[^A]*?)\s*$/;</div>
<div>var str = 'Start: Hello world';</div>
<div>if(str.search(reg_date) != -1) alert(RegExp.$1);</div>
<div> else alert ("No match...");</div>
<p><button onclick="show();">start</button></p>
</body>
</html>