javascript regex pattern concatenate with variable

Posted by chazzuka on Stack Overflow See other posts from Stack Overflow or by chazzuka
Published on 2010-04-26T11:03:35Z Indexed on 2010/04/26 11:13 UTC
Read the original article Hit count: 251

Filed under:
|

How to create regex pattern which is concatenate with variable, something like this:

var test ="52";
var re = new RegExp("/\b"+test+"\b/"); 
alert('51,52,53'.match(re));

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex