I have a very long text that looks like this:
1- E.M. Smith, J.P. LAVERGNE, P. VIALLEFONT et J. DAUNIS. Recherches en série triazépine-1,2,4. J. Heterocyclic Chem. 12, 66 (1975).
2- M. BENCHIDMI et E.M. ESSASSI. Synthèse de bis s-triazolo [4,3-b : 4,3-d] triazépines-1,2,4. J. Heterocyclic Chem., 13, 885 (1976).
3- LAVERGNE et P. VIALLEFONT. Hydrazinolyse d'azabenzodiazépinones et d'azabenzodiazépine-thiones de type 1,5. Tetrahedron, 33, 28O7 (1977).
4- E.M. ESSASSI. "Synthèse et étude de RMN1H en présence de l'Eu(fod)3 des pyrazolo [1,5,4-ef] benzodiazépine-1,5 ones-6 Bull. Soc. Chim. Belg., 96, 399 (1987).
. . . .
And the list continues for over 300 more, I need to extract each line and add it into an Insert Query for MySql, removing the list numbers and escaping all quotes and double quotes, I have though about using regular expressions but it turns out to be quite difficult for me.
The insert query should look like:
INSERT INTO PUBLICATIONS (NAME,AUTHOR,CITE,PUB_YEAR) VALUES
("Recherches en série triazépine-1,2,4.", "E.M. Smith, J.P. LAVERGNE, P. VIALLEFONT et J. DAUNIS.","J. Heterocyclic Chem. 12, 66","1975"),
( "Synthèse de bis s-triazolo [4,3-b : 4,3-d] triazépines-1,2,4.", "M. BENCHIDMI et E.M. ESSASSI.","J. Heterocyclic Chem., 13, 885","1976" ),
etc.
I just gave some format to the text to have some idea but it has no spaces or next lines, it is all in one huge string.
What I have thought is using something like:
$string = "all my string"
$pattern = '/regex pattern/';
$replacement = 'result format';
echo preg_replace($pattern, $replacement, $string);
I realized that splitting it up might be impossible as there is no specific pattern so I could maybe add a manually to split each line
Thanks a lot!