Regex to remove first line in a text file
Posted: 10 Mar 2019 04:43
Hello, I've been searching for a while and tried many things and having a difficult time coming up with the right regex to remove the first line of a text file.
What I have is:
Does anyone have any suggestions?
What I have is:
Code: Select all
$oldContent = readfile("$testFile");
$newContent = regexreplace($oldContent, "^([0-9a-zA-Z_.#\-]*[a-zA-Z0-9]{3}[0-9]{3}~[0-9a-z\-]*\.[a-z]*)(.*)$", $1);
$newContent = regexreplace("$newContent", "\s|\S*", ""); // I cannot get this to completely delete the first line for the text to be written
writefile("$testFile", $newContent);