fork(2) download
  1. import re
  2. text = "this is a.match\nthis should also match.1234\nand this should 123.match\n\nthis should NOT match. Has space after period\nthis also should NOT match 1.23"
  3. print(re.sub(r'\.(?!(?<=\d\.)\d) ?', '. ', text))
Success #stdin #stdout 0.02s 9244KB
stdin
Standard input is empty
stdout
this is a. match
this should also match. 1234
and this should 123. match

this should NOT match. Has space after period
this also should NOT match 1.23