14 Aug 2013
DominicZA
1 alternative
I am trying to remove all the instances of a number except for a number that I supply. This is currently what I have:var ar = '10,13,9,8,13,10,5,3,1,9,5,8,10,2,6';var removed = ar.replace(new RegExp('[^(' + 10 + ')]', 'g'), '')The result of this is "101110110", but I need it to...