4
I’m getting a file .txt and excluding the letters and lines in white. It is giving problem with the special character \t or \s he doesn’t recognize. 
The code below:
<?php
function pass1() {
    $treat = fopen ("C:\\Users\\Bridge\\Downloads\\D_lotfac\\lott.txt", "r+w+");
    $treat1 = fopen ("C:\\Users\\Bridge\\Downloads\\D_lotfac\\lott1.txt", "r+w+");
    while (!feof ($treat)) {
        $linha = fgets($treat,4096);
        $patterns = array();
        $patterns [0] = '/[(A-Z)i]*/';
        $patterns [1] = '/Â|Ã|Á|À|É|Ê|Í|Î|Ç|Ó|Õ|Ô|Ö|Ú|Û|Ü/';
        $patterns [2] ='/ã|â|à|á|é|ê|í|î|ç|ó|ô|ô|ö|ú|û|ü/';
        $patterns [3] = '/\t/';                 
        $patterns [4] = '/[(a-z)i]*/';
        $patterns [5] = '   ';
        $replacements = array();
        $replacements[] = '';
        $linha = preg_replace($patterns, $replacements, $linha);
        fwrite ($treat1, $linha); 
        printf($linha . "<br>");
        }
}
It’s generating the file lott1.txt correctly, only that the tabs are not being removed nor the spaces (2x, 3x, etc ). I have literally put tab "" or put \t inside the array $pattern[]. Does not eliminate. 
What’s the matter?
use a single
pattern, to\w, it accepts all characters except the special ones– Murilo Melo
tried to change the tab to
/\t+/– Neuber Oliveira
@user6855041 put one before and after the file, this can help further understand your doubt?
– novic
for spaces, use
/\s+/(1 or more occurrences) ,/\s{5}/(5 occurrences)– lucasvscn
@lucasvscn I recommend you read What the REGEX shortcut means?
– Guilherme Lautert
@Guilhermelautert thanks for the indication.
– lucasvscn