I'm trying
perl -pe 's;\A(?!syntax:);syntax: glob\n\n;' .hgignore
On a file with these contents:
dist
node_modules
.vscode
The output I expect is:
syntax: glob
dist
node_modules
.vscode
With the caveat that I can run it repeatedly and it won't keep pre-pending.
I use \A(?!syntax:)
to anchor the regex to the start of the file and then (?!
to say "not followed by". Looks like \A
is matching the start of the line, not start of file.
How can I match only the very start of the file?