JSFiddle - React, Tailwind, and code Playground

JavaScript

const RE_DOLLAR_PREFIX = /(?<=\$)foo/g;
console.log('$foo %foo foo'.replace(RE_DOLLAR_PREFIX, 'bar'));