For example, consider Javascript object document.I wish to replace the string "document." with "doc." such that:
- In a case such as xyz.document.abc "document." is not replaced.
- When a variable is of form predocument.xyz "document." is not replaced.
- When there is a case such as document.abc or (document.abc or =document.abc or +document.abc etc "document." is replaced.
Since Javascript does not support look behind regex please suggest an alternative
([^\w.])document(?=[^\w]|\b)and replace with$1doc. Regex101 demo.