The language is not specified, and I used PHP, but the expression is quite general and can be reused in other environments:
<?php $s = 'This is a text.With some dots.Between words.(how lovely).'; $r = '~(\w)(\.)(\w)~'; echo preg_replace($r, '$1 $3', $s);
this code leads to the following line output:
This is a text With some dots Between words.(how lovely).
- (\ w) matches exactly one alphanumeric character before the dot
- (.) matches the dots
- (\ w) matches exactly one alphanumeric character after the period
the first and third matches are referred to in the replacement string as $ 1 and $ 3
ioseb
source share