I know about the negative look behind (?<!)
operator, but it appears that the Javascript engine used in Expo/React-Native does not support it. What I want is to implement the following
export function processEmbedded(text: string): string { return text.replace(/(?<!!)\[Embedded\]/gm, "![Embedded]");}
What I did was a bit hacky in that I stripped and re-added.
export function processEmbedded(text: string): string { return text .replace(/!\[Embedded\]/gm, "[Embedded]") .replace(/\[Embedded\]/gm, "![Embedded]");}
For my cases it does work, but I am pretty sure there's an edge case where it does not.