diff --git a/lib/index.js b/lib/index.js index c12aadd..1032a38 100644 --- a/lib/index.js +++ b/lib/index.js @@ -35,8 +35,8 @@ export default (options = {}) => tree => { const partWords = part.trim().split(/\s+/) if (replace && partWords.length >= options.minWords) { return options.createWidows - ? part.replace(/ ([^ ]+)$/, ' $1') - : part.replace(/ ([^ ]+)$/, ' $1') + ? part.replace(/ ([^ ]+)$/g, ' $1') + : part.replace(/ ([^ ]+)$/gm, ' $1') } return part })