<?php $string = "// blah blah blah\n\nconst filename = \"\";\n\n// blah blah blah"; echo preg_replace('~^(\h*const\s+filename\s*=\s*).+~mi', '$1"NEW VALUE";', $string);
You have javascript disabled. You will not be able to edit any code.