Right regex expression to find out a string of characters

Hi there, I am looking for the right expression of regex to find the string of characters including upper and lower case letters and numbers with length of , say between 10 to 14, to be found anywhere on the file (any applicable type of files), even if it starts on one line and ends up on the next line. Also what it would be if I want to limit the letters and numbers by ignoring certain letters (upper or lower cases ) and digits. Any suggestion can be usefull.

Thanks to all you reply in advance :)

Parents
  • There is also a simple way to match a simple-known-pattern in any string in any text based file -

    get-content *.txt | select-string '12Had04Geod5q7' |  Select-Object filename,LineNumber,Line

    you can get as fancy as you'd like with select-string, where pattern follows standard matching rules or regex

    an example I use - it to find words in scripts that I want to re-use

    $ftypes = (".ini",".xml",".txt",".ps1",".psm1",".log")

    get-childitem  .\ -file |
       where {$_.extension -in $ftypes} | 
       Select-String -Pattern "edms|ldap" | 
       Select-Object filename,LineNumber,Line


    It will return some strings from some binaries - but it's a wee bit ugly.  Guessing not designed for that.

Reply
  • There is also a simple way to match a simple-known-pattern in any string in any text based file -

    get-content *.txt | select-string '12Had04Geod5q7' |  Select-Object filename,LineNumber,Line

    you can get as fancy as you'd like with select-string, where pattern follows standard matching rules or regex

    an example I use - it to find words in scripts that I want to re-use

    $ftypes = (".ini",".xml",".txt",".ps1",".psm1",".log")

    get-childitem  .\ -file |
       where {$_.extension -in $ftypes} | 
       Select-String -Pattern "edms|ldap" | 
       Select-Object filename,LineNumber,Line


    It will return some strings from some binaries - but it's a wee bit ugly.  Guessing not designed for that.

Children
No Data