I was wondering if it was possible to replace certain strings but not others that contain the same value in javascript. For example, say I had the text A AB and wanted to replace only the standalone A but not the A in AB. (Note: I know that I could do this manually in this case, but I plan on using scenarios like this throughout large blocks of text) Is there an algorithm or built in js command for doing this?
I was wondering if it was possible to replace certain strings but not others
Share
Use a regular expression with word boundaries.