I am trying to find the first word of every paragraph using a regex in JavaScript. I am doing so with the following:
function getFirstWordInParagraph(content) {
return content.match(/\n\S+/gi);
}
The problem here is I cannot figure how to match the new line character, but exclude it from the result. Is this possible with a JavaScript regex?
Note: the function does not account for the first word of the first paragraph.