jquery match() variable interpolation - complex regexes
I've already looked at this , which was helpful to a point. Here's the problem. I have a list of users propagated into an element via user click; something like this: <div id="box"> joe-user page-joe-user someone-else page-someone-else </div> On click, I want to make sure that the user has not already been clicked into the div. So, I'm doing something like: if ( ! $('#box').html().match(rcpt) ) { update_div(); } else { alert(rcpt+' already exists.'); } However, with existing lack of interpolation that javascript has for regular expressions, is causing my alert to trigger in the use-case where