I am matching each words against identical paragraph words.
Update 1: I realise just accepting punctation you need does not solve this issue.
Example 'hello-' and 'hello' , are consider seperate word.
Is there a way to remove punctuation before and after word and stand alone punctuation? Only allow punctutation within word.
$string="_ - – hello’ hello' hello, hello- world. he,llo hello-world hello_world hel-lo-world hello9world";
The output should be
hello hello hello hello world he,llo hello-world hello_world hel-lo-world hello9world
Only word or punctuation within word
Update 2: If word only or punctuation within word, decimal number will have issue.
1.0 still ok, .1 as punctuation remove before and after, will become 1 instead of 0.1
Update 3: With accepting punctuation in word, Substrings start or end with a letter or a number will have issue. 20-year-old will become '20-' 'year-old'.
Thanks mickmackusa.