On 17 Oct 2007, at 13:47, Chris Knowles wrote:

Nick Fitzsimons wrote:
Word boundaries aren't right either; for exmple, they will match a
hyphen, so matching on some-thing will match some-thing-else. As per the
HTML spec, class names are space-separated, so you need to match on
spaces and the beginning or end of the string.


of course, class names are separated by whitespace so hopefully this is
it...

    var re = new RegExp('\\s' + className + '\\s');

Nope, that won't match "thing" to "thing", only to " thing " - you need to check for the start or end of the string as well as a space :-)

HTH,

Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to