react replace space with dash code example Example: javascript replace spaces with dashes title = title.replace(/\s/g , "-");