As the title suggests im trying to wrap every word in a tag server-side. But iam missing the right RegEx. My current PHP Code looks like this. function exampleFuncti
Solution 1:
Use this code:
Try this regex:
var str = "This string... it's, an. example! <em>string</em>?!";
str.replace(/([A-z0-9'<>/]+)/g, '<span>$1</span>');
Example:
var str = "This string... it's, an. example! <em>string</em>?!";
str = str.replace(/([A-z0-9'<>/]+)/g, '<span>$1</span>');
console.log(str);
Share
Post a Comment
for "Regex Wrap Every Word In A Span Tag"
Post a Comment for "Regex Wrap Every Word In A Span Tag"