#!/bin/bash
text="manoeuvre man man trackman"
replace="man"
perl -spe 's/\s*(?!\B\w)\Q${replace}\E(?<!\w\B)//g' -- -replace="$replace" <<< "$text"