Matt Ball's solution is good, but if you have a paragraph and an image or markup or quotation marks, the regular expression will not just fail, but break the html for example
<p><strong>Important</strong></p> or <p>"Important"</p>
You can avoid html hacking in these cases by adding "'<to the selected start characters. Although in this case there will be no range wrapped on the first character.
return html.replace(/^[^a-zA-Z'"<]*([a-zA-Z])/g, '<span class="big-cap">$1</span>');
I think that Optimally you can wrap the first character after "or" However, I believe that it is better not to wrap the character if it is already in the markup, but this probably requires a second replacement.
source share