I have a regex pattern that matches leading characters before (a, b, c or i) in only the first word of a string: /^\s*[^abci]+(?=\w)/i such that:
"sanity".replace(/^\s*[^abi]+(?=\w)/i, (pattern) => 'v');
// "vanity"
How do i define the regex newRegex such that it matches leading characters in every word of a string so that:
"sanity is a rice".replace(newRegex, (pattern) => 'v');
outputs: vanity is a vice
.replace(/\b[^\Wabi]/gi, 'v')/.../g= global flag to ensure all possible matches, not just the first one/\b[^abi]\B/gi