Say I have a line filled with soft hyphens (pretend that the hyphens in the text below are soft hyphens):
T-h-i-s- -i-s- -a- -t-e-s-t-.-
I want to remove soft hyphens and return a string:
This is a test.
I am trying to do this in JavaScript. Below is the farthest way I've got so far:
RemoveSoftHyphen: function (text) {
var result = text.match(/[^\uA00AD].*/);
alert (result);
return result;
}
When the warning appeared, all I got was a “-”, and I'm not sure if this is a soft or hard hyphen ... but more importantly, it did not work.
I'm trying to figure out what is wrong with my regex, or is there a better approach to removing soft hyphens that I don't know about using JavaScript or jQuery.
source
share