I am still new to regex and I've run into a bit of a problem. I am building a parsing script and I need to to be able to pull out lines with a certain length out of a file.
How would I write a regex to match lines that have a certain number of words? Eg I want to match all lines in a file that have 3 words.
Could I extend that to find all lines within certain parameters? Eg I want to match all lines in a file that have between 2 and 5 words.
I am using perl in case that matters. Thanks!