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

mod rewrite - Using "?" when rewriting the URL -

.htaccess: Transfer name to index.php if not directory public -

Admob integration with pygame in android -