Here ya go:
postText = 'this is a #test of #hashtags'; var regexp = new RegExp('#([^\\s]*)','g'); postText = postText.replace(regexp, 'REPLACED');
This uses the attribute 'g', which means "find ALL matches" instead of stopping at the first occurrence.
Ian McIntyre Silber
source share