As a result of text extrapolation from PDF's I need to fix some bugs. I need to replace every form of strings like these:
String example="the sun was shin- ing and the sky bl- ue";
in the form:
String fixxed="the sun was shining and the sky blue";
I'm not expert in regular expressions, I tried to do so but it's wrong.
String pattern="([\\w])+([\\-])+([\\s])";
String fixxed = text.replaceAll(pattern, "$1");
An important specification, I only have to replace the substring if the character before '-' is a letter (not a space and not a number).