regex - Find all lines with a length greater than N -


this first question here. beginning powershell.

let's have text file , want match lines length greater 10 characters. made simple regex.

$reg = "^\w{0,10}$" 

and use notmatch operator.

$mytextfile | select-string -notmatch $reg 

this not working. tried

$reg = "^[a-za-z0-9]{0,10}$" 

but not working either.

any clue me? lot!

you don't need regex match. this:

get-content $mytextfile | ?{$_.length -gt 10} 

if want regex, dot matches character. work...

get-content $mytextfile | select-string -notmatch '^.{0,10}$' 

...but simpler:

get-content $mytextfile | select-string '.{11,}' 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -