In comp.lang.javascript message <uT**************@twister.nyroc.rr.com>,
Sun, 10 Dec 2006 15:40:10, mick white <mi**@mickweb.comwrote:
>whisher wrote:
>function isTheSame(string1,string2)
{
string1 = new RegExp(string1)
return string1.test(string2);
}
alert(isTheSame('pippo','pippo'));
alert(isTheSame('pippo','ripippotorasaurus'));
Clearly they're not the same.
But
function isTheSame(string1, string2) {
return new RegExp(string1).test(string2) && new
RegExp(string2).test(string1)}
works better. Wouldn't use it myself, though, except to confuse.
--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
<URL:http://www.jibbering.com/faq/ Old RC FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.