Closed tomkenny closed 6 years ago
If I'm not mistaken the regex for the current string only needs to be:
console.log(text.replace(/(^|\W)'/g, '$1"'));
For the extra regex that is indicated to be required I think the end period needs to be outside the quotations, such as:
let text = "'I'm the cook,' he said, 'it's my job'."
Yes, for this particular example your regexp would also work, but the exercise asks for a regexp that matches all quotes except those in contractions.
If I'm not mistaken the regex for the current string only needs to be:
console.log(text.replace(/(^|\W)'/g, '$1"'));
For the extra regex that is indicated to be required I think the end period needs to be outside the quotations, such as:
let text = "'I'm the cook,' he said, 'it's my job'."