minus-squareSelena@lemmy.worldOPtoPerchance - Create a Random Text Generator@lemmy.world•Force .Replace to reference whole string, not part of a stringlinkfedilinkEnglisharrow-up5·4 months agoAaand found a solution on the discord. Which I’ll post here in case anyone else finds this thread and needs help. Solution: .replace(/^word$/, ‘replace’) where ^ denotes the start of the word/line and $ denotes the end of the word/line. linkfedilink
Selena@lemmy.world to Perchance - Create a Random Text Generator@lemmy.worldEnglish · 4 months agoForce .Replace to reference whole string, not part of a stringplus-squareperchance.orgexternal-linkmessage-square3fedilinkarrow-up16arrow-down10
arrow-up16arrow-down1external-linkForce .Replace to reference whole string, not part of a stringplus-squareperchance.orgSelena@lemmy.world to Perchance - Create a Random Text Generator@lemmy.worldEnglish · 4 months agomessage-square3fedilink
Aaand found a solution on the discord. Which I’ll post here in case anyone else finds this thread and needs help.
Solution: .replace(/^word$/, ‘replace’) where ^ denotes the start of the word/line and $ denotes the end of the word/line.