I am trying to create a regex on Drafts. The Regex is working on Regex101, but it seems that the escaping \ is not working properly on Drafts.
I need to get all the images with this formatting : ![[path/to/image]]
Here my script :
const regexp = RegExp('\!\[\[','gmi'); const images = regexp.exec(draft.content);
If i try a Regex without the escaping \ it’s working perfectly.
Thanks for your help,
EDIT: I don’t know why but with the RegExp you need to double escape \. But the same regex doesn’t work with draft.content.replace(‘Regex’, “”);
I really don’t understand the logic… I need to use the replace function too but the escaping seems different. Who could help me with this ?