From: Dr J R Stockton on
XP : CLJ, MPSJ

In comp.lang.javascript message <39z7lrz9.fsf(a)gmail.com>, Wed, 7 Apr
2010 08:03:06, Lasse Reichstein Nielsen <lrn.unread(a)gmail.com> posted:
>Dr J R Stockton <reply1014(a)merlyn.demon.co.uk> writes:
>
>> <URL:http://www.merlyn.demon.co.uk/js-valid.htm#RsT> tests the current
>> browser, and reports the results of my tests, for what \s (& \w)
>> recognises. Perhaps it should also test \b.
>
>Only if \b is expected to be broken, since \b is defined in terms of
>word-characters (\w).

The cautious expect that anything might be broken.

Who otherwise would expect new Date() + " " + new Date() to err? *
Who otherwise would expect an offset from GMT of "0159"? *

Which VBScript user would expect an error in ISO Week Number thrice per
28 normal years plus once per 400?

>Are there any browsers that implement \w incorrectly (i.e., as anything
>but [a-zA-Z0-9_])?

Yes, IE 8 adds dotted I. It may well be that the two extra \b found by
IE 8 in my test string are on each side of dotted I. One at least is
.... both are. Tests in JS-valid, link above.


The set recognised by \w should be checked using WSH CScript/WScript,
hence the cross-post. Lines ending * are not for JScript.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (RFCs 5536/7)
Do not Mail News to me. Before a reply, quote with ">" or "> " (RFCs 5536/7)
From: Hans-Georg Michna on
On Tue, 06 Apr 2010 15:52:09 -0700, Garrett Smith wrote:

>Where supported, you can use HTML 5 DOMTokenList `element.classList`[1][2].

We may have to wait another couple of years for widespread
implementation.

>What you have works and is close what I use. I the RegExp constructor to
>build a RegExp object using "(?:^|\s+)" + token + "(?:\s+|$)". I cache
>the result in an object so if the function finds that there is already
>one created, it just returns that object. I do this because usage
>pattern results in the same regexp object being used over and over.

Interesting. Thanks!

In my casse the caching is not worth the trouble, but it's a
good thought.

Hans-Georg