No need for parentheses; nor to escape the space; nor for the 'g' modifier - '.*' will gobble everything up, thus there can be only one match. So:
perl -p -i -e "s/^macros.*/macros regex/" monks.txt # or perl -p -i -e "s/^macros\K.*/ regex/" monks.txt
In reply to Re^2: Perl One Liner Regular Expressions
by hbm
in thread Perl One Liner Regular Expressions
by stallion
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |