If I have:
bob\nwas\nhere
I would like RegEx to output:
*bob**was**here*
Where an asterisk was pl开发者_StackOverflowaced at the start and end of each line, and the new line character was removed.
I'm using JavaScript/jQuery.
var input = 'bob\nwas\nhere',
re = /\n/g;
alert('*' + input.replace(re, '**') + '*');
Demo
精彩评论