Skip to content

Commit

Permalink
Fix replace in between RX
Browse files Browse the repository at this point in the history
  • Loading branch information
yoannmoinet committed Jan 16, 2025
1 parent 167118f commit e401db0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/tools/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const replaceInBetween = (content: string, mark: string, injection: strin
const escapedMark = mark.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const escapedInjection = injection.replace(/\$/g, '$$$$');
const rx = new RegExp(
`${escapedMark}([\\S\\s](?!${escapedMark}))*(\\s|\\S)${escapedMark}`,
`${escapedMark}([\\S\\s](?!${escapedMark}))*(\\s|\\S)?${escapedMark}`,
'gm',
);
return content.replace(rx, `${mark}\n${escapedInjection}\n${mark}`);
Expand Down

0 comments on commit e401db0

Please sign in to comment.