I want to remove the space between the two words only. To find these words in the file [A-Za-z]+(\s[A-Za-z]+)
this expression works perfectly. But now, I want to know with which regular expression should I replace this to remove the space.
eg. Original: tables, two tables, chair
What I want: tables, twotables, chair
Here is a way to go:
(?<=[a-z])\h+(?=[a-z])
LEAVE EMPTY
Explanation:
(?<=[a-z]) : lookbehind, make sure we have a letter before
\h+ : 1 or more horizontal spaces (ie. space or tabulation)
(?=[a-z]) : lookahead, make sure we have a letter after
Result for given example:
tables, twotables, chair
Edit:
For unknown reason, it doesn't work when we use Replace instead of Replace all.
We have to use:
([a-z])\h+([a-z])
$1$2