heres the string https://www.xmodulo.com/search-and-replace-multi-line-string.html The -0 option turns Perl into “file slurp” mode, where Perl reads the entire input file in one shot (intead of line by line). This enables multi-line search and replace. better version below https://www.codegrepper.com/code-examples/whatever/regex+ignore+newline Great resources https://jkorpela.fi/perl/regexp.html