Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
(?<=<!-- Template Nav Start -->[\n])([\n\s\S]*?)(?=[\s\n]*?<!-- Template Nav End -->)
/
gm

Description

Used with Visual Studio Code to search and replace text in between two markers. I use this to template in things that occur on multiple pages like the navigation menu. I know this can be done with javascript or servers side scripting, but sometimes I just want to pre process all of this like in the old Dreamweaver days:-)

Submitted by Bishop - 2 years ago