I want to use regex in JavaScript to replace some words in a multi-line text. Origin:
Doka (1) is 20 years old. Doka, (2) Sole are my friends. Sole told me "Doka (3) is a nice gỉrl!"
Doka: (4) student of Hamma school.
I met Doka (5) yesterday.
Result of replacement as expected:
Bob (1) is 20 years old. Bob, (2) Sole are my friends. Sole told me "Doka (3) is a nice gỉrl!"
Doka: (4) student of Hamma school.
I met Bob (5) yesterday.
In this example, I would want to replace Doka (1, 2, 5) with Bob. The conditions to replace a match are:
- Not inside double quotes.
- Not between a carriage return and a colon.
How can I do that?