I think I've found a bug in the _javascript_ RegEx implementation in Netscape 6 (for Windows, anyway). Below is a RegEx pattern for a non-IP email address. The first alert shows zero, which is a match beginning with the first character, but the second alert shows '-1', indicating no match. The only difference is using $ for an end-of-line anchor. This code works correctly in NS4(!), NS7 and IE6. Any JS gurus out there have any ideas for a workaround for this?
Thanks,
Chris
<SCRIPT LANGUAGE="_javascript_">
var s = '[EMAIL PROTECTED]';
alert(s.search(/^['_a-z0-9-]+(\.[_a-z0-9-]+)*@([a-z0-9-]+\.)+([a-z]{2,3}|aero|coop|info|museum|name)/i));
alert(s.search(/^['_a-z0-9-]+(\.[_a-z0-9-]+)*@([a-z0-9-]+\.)+([a-z]{2,3}|aero|coop|info|museum|name)$/i));
</SCRIPT>
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
- Re: JavaScript RegEx bug in NS6? Lofback, Chris
- Re: JavaScript RegEx bug in NS6? Massimo, Tiziana e Federica