Find all lines with a length greater than N

Question:

This is my first question here. I am just beginning with Powershell.

Let’s say I have a text file and I want to match only the lines with a length greater than 10 characters. So I made a really simple regex.

And I use the notmatch operator.

This is not working. I also tried

but this is not working either.

Any clue for me? Thanks a lot!

Answer:

You don’t need a regex match. Just do this:

If you want to do it with a regex, the dot matches any character. This will work…

Source:

Find all lines with a length greater than N by licensed under CC BY-SA | With most appropriate answer!

…but this is simpler:

Source:

Find all lines with a length greater than N by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply