So, I have to read a text file and get certain fields like name*: xxxxx, and save the xxx in a new file.. I've been using Regex to get the xxxx and save them in the text file and its working well, the only problems is that when i find empty fields like name*: The preg_match skips them, and the result i want is to save them as empty spaces " ".
here is my code and a bit of the file i need to fix the problems:
else if (preg_match("/^Data\sde\semiss.o\sdo\sBI\:(.+)/", $line, $matches)) {
//print_r($matches);
$total[$titular][]=$matches[1] . ";";
}
Data de emissão do BI:
Arquivo de Identificação: FUNCHAL
Nº de Contribuinte*: 12341234
I need to get a $match equal to the spaces after "Data de emissão do BI:" so i can fill an empty cell (in a csv file)