I have a string, e.g.:
"The red letters in the following words are suffixes: beauti*ful*, speech*less* and invinc*ible*."
I want to replace the first of each ** pair with <span class='red'> and the second with </span>. I can do this in a for loop, but would like to know how to do it with RegExp.
How about:
\*([^*]*)\*is a little confusing, it searches for:\*– the first asterisk([^*]*)– the content between the asterisks (captures, so we can replace using$1.\*– the second asteriskWorking example: http://jsbin.com/isufes