Perl: just "^" a word match: $ lines only matches the beginning of each line = ~ s / ^ / file_4_ex_ch7.txt: / gm;