named subpattern preg_match problem
Posted: Wed Apr 25, 2012 7:50 am
I got following format input
now I am trying to use preg_match with named subpatterns on that with limited success.
works fine on the numbers that can be extracted but now I get problems with the text fields, that can basically be off any char CR etc.
I am not able to get the text stuff working at all.
Any help would be appreaciated.
Code: Select all
$plain = "INSERT INTO storyentries (p_id, e_id, c_id, e_imp, e_email, e_title, e_text, e_url, e_create, IP ) VALUES ('2', '420', '11977','1','test@test.com','Test Title','Normal text with CR and extra chars','http://www.test.com',NOW(),'127.0.0.0' )";
Code: Select all
preg_match("/^INSERT INTO entries \(p_id, e_id, c_id, e_imp, e_email, e_title, e_text, e_url, e_create, IP \) VALUES \('(?P<page_id>\d+)', '(?P<entry_id>\d+)', '(?P<ortid>\d+)','(?P<entry_importance>\d+)'/", $plain, $treffer);
I am not able to get the text stuff working at all.
Any help would be appreaciated.