Skip to content

Instantly share code, notes, and snippets.

@jonjamz
Last active August 29, 2015 14:01
Show Gist options
  • Save jonjamz/b45f0d8fb049cdecdd42 to your computer and use it in GitHub Desktop.
Save jonjamz/b45f0d8fb049cdecdd42 to your computer and use it in GitHub Desktop.
Replace first-level bullet points with numbered points
window.post = $('textarea').val()
var i = 1;
window.post = window.post.replace(/(\n)[^\s](\\*)/g, function(str, p1, offset, s) {
return '\n' + i++ + '.';
});
$('textarea').val(window.post);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment