Search code examples
regexpcreautoitregexp-replace

Remove lines from text file


I have a text file from which I want to exclude lines which start with the number 1 to 9. I tried to replace them with blank (empty string) using regular expressions ^\d+(.*)$ and ^[1-9](.*)$, but it doesn't work.

I am using AutoIt's StringRegExpReplace() command.


Solution

  • The anchors ^ and $ match at the beggining and end of string by default.

    To make them match at the beggining and end of line, you have to set the MULTILINE (?m) modifier.

    (?m)^\d.*$