diff --git a/src/utils/templates/match-all.ts b/src/utils/templates/match-all.ts index 786adc8b..d554bde8 100644 --- a/src/utils/templates/match-all.ts +++ b/src/utils/templates/match-all.ts @@ -1,2 +1,2 @@ export const MATCH_ALL = '(.|\r?\n)*'; -export const MATCH_LF = '\r?\n'; +export const MATCH_LF = '\r?\n?'; diff --git a/src/utils/templates/remove-functions/remove-placeholder.ts b/src/utils/templates/remove-functions/remove-placeholder.ts index aaf0e43a..ab90bec5 100644 --- a/src/utils/templates/remove-functions/remove-placeholder.ts +++ b/src/utils/templates/remove-functions/remove-placeholder.ts @@ -2,8 +2,7 @@ import * as M from '../match-all'; export const removePlaceholder = (text: string, P: any): string => { return text.replace( - new RegExp( - `${P.START_BLOCK}([\\D\\d])(?:.|\n)*?(?=${P.END_BLOCK})${P.END_BLOCK}${M.MATCH_LF}`, + new RegExp(`${P.START_BLOCK}(?<=${P.START_BLOCK})(.*)(?=${P.END_BLOCK})${P.END_BLOCK}${M.MATCH_LF}`, 'g', ), '', diff --git a/test/data/template_tags_bottom.templ b/test/data/template_tags_bottom.templ index eca600be..5023ed2c 100644 --- a/test/data/template_tags_bottom.templ +++ b/test/data/template_tags_bottom.templ @@ -8,6 +8,7 @@ {metadata-block} {created-at-block}_Created at {created-at}._{end-created-at-block} {updated-at-block}_Last updated at {updated-at}._{end-updated-at-block} +{source-url-block}_Source Url[] {source-url}._{end-source-url-block} {end-metadata-block}