Regular Expressions 101

VS Code find replace template block

Open Workspace
  • JavaScript
  • Match
0

Regular Expression

/
(?<=<!-- 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