I have the following jQuery
$("h1").text($("h1").text().replace(/([^\s-]{5})(?=[^\s-])/g, '$1­'));
­ is supposed to be optional "-" + <br />, so I want it to be there in case someone enters a very long word as the title so that instead of being chopped off, it is split onto separate lines.
currently, it will change "ThisVeryLongWord" to "ThisV­eryLo­ngWor­d" on the page where it should change it to
ThisV-
eryLo-
ngWor-
d
(assuming that the word needs to be broken at each spot)
what am I doing wrong?