Here I am again, stuck with a regular expression.
I have this, in a text file:
$subject:
term#semestre
fail<br>
flunk#ser reprovado
prova#test
lanche<br>
merenda<br>
grude<br>
gororoba<br>
bandejão#lunch
I run the replace operation, and the result is 5 mySQL columns:
('null', 'term', 'semestre', 'my_glossary', 'null'),
fail<br>
('null', 'flunk', 'ser reprovado', 'my_glossary', 'null'),
('null', 'prova', 'test', 'my_glossary', 'null'),
lanche<br>
merenda<br>
grude<br>
gororoba<br>
('null', 'bandejão', 'lunch', 'my_glossary', 'null'),
So multi-line entries are slipping away from the replace operation. What I want is:
('null', 'term', 'semestre', 'my_glossary', 'null'),
('null', 'fail<br>flunk', 'ser reprovado', 'my_glossary', 'null'),
('null', 'prova', 'test', 'my_glossary', 'null'),
('null', 'lanche<br>merenda<br>grude<br>gororoba<br>bandejão', 'lunch', 'my_glossary', 'null'),
My regular expression is:
$result = preg_replace ("/(.[#])#(.[#])\r(<br>(.*[#]))/s", "('null', '\1', '\2', 'Juridico', 'null'), <br>", $subject);
I've spent two hours already trying to find the right RegExp that can do do what I want, I can't take it anymore. If anyone is willing to help, thank you very much.
Luciano ES
Santos, SP - Brasil