I done now but i have to call 2 times .removeClass()
functions
How can I merge this to find the result in one regex call?
HTML :
<div class="one-abc two-cba three-bac"></div>
jQuery :
$('div')
.removeClass(function(i,c){var m=c.match(/one-[a-z]{0,5}/);return m?m[0]:m;})
.removeClass(function(i,c){var m=c.match(/two-[a-z]{0,5}/);return m?m[0]:m;});
Demo : http://jsbin.com/umoded/1/edit