ptolomea Posted September 28, 2007 Share Posted September 28, 2007 I'm getting this error in my ereg() Warning: ereg() [function.ereg]: REG_BADBR in populate.php on line 10 Line 10 if (ereg("^[:punct:]{1}[:alnum:][:punct:]{1,4}[:alnum:][:punct:]{1,4}[:alpha:](.*)$",$currentDKP[$linenum],$regs)){ what i'm trying to read. "Hanover Street (Special Edition)","Columbia/Tri-Star",,"Out","4.0","LBX, 16:9",9.95,"PG","1979","Drama","2.35:1","043396058316",2001-07-31 00:00:00,11881,2006-02-14 00:00:00 "Marathon Man","Paramount",,"Out","5.1","LBX, 16:9",9.99,"R","1976","Mystery/Suspense","1.85:1","097360878943",2001-08-28 00:00:00,12354,2006-08-11 00:00:00 I have a txt file with 127,000 of those i'm trying to get into a mysql database from what i have read and searched on I think it is a repetition error but I don't know where Its all comma seperated values Quote Link to comment https://forums.phpfreaks.com/topic/71044-solved-ereg-help-reg_badbr/ Share on other sites More sharing options...
effigy Posted September 28, 2007 Share Posted September 28, 2007 Change your double quotes to single or escape the $. Better yet, try File_CSV. Quote Link to comment https://forums.phpfreaks.com/topic/71044-solved-ereg-help-reg_badbr/#findComment-357205 Share on other sites More sharing options...
ptolomea Posted September 29, 2007 Author Share Posted September 29, 2007 So wasted a large amount of time trying to get pear installed on my development server and because I was not paying attention durring install had a few wrong directory's and had to reinstall my server (no big deal its a development server for a reason) If you mean changing the double quotes in my text file i'd rather not since there is 127,000 (One Hundred Twenty Seven THOUSAND, the text file is 20mb!) entrys... I don't see how escaping the $ will help as for now I'm off to reread some regex tutorials to see if i can rewrite my search. Quote Link to comment https://forums.phpfreaks.com/topic/71044-solved-ereg-help-reg_badbr/#findComment-357717 Share on other sites More sharing options...
ptolomea Posted September 29, 2007 Author Share Posted September 29, 2007 have made some progress but not quite getting the responce I'm looking for if (ereg("(^[[:punct:]]{1})(.+)([[:punct:]]{3,4})",$currentDKP[$linenum],$regs)){ if i echo $regs[2] i get the first part of what i want but the problem is the rest of the junk that I dont which would start at "," heres an example 10 Things I Hate About You","Buena Vista",,"Out","5.1","LBX",14.99,"PG-13","1999","Comedy","1.85:1 is there a way i can tell it to get digits,text and spaces till "," with all my looking around and reading I have done nothing but made my head hurt alot and get tired. Not to mention I also tried to figure out the one in your sig effigy I'm going to pick this back up in the morning, Night Quote Link to comment https://forums.phpfreaks.com/topic/71044-solved-ereg-help-reg_badbr/#findComment-357742 Share on other sites More sharing options...
ptolomea Posted September 29, 2007 Author Share Posted September 29, 2007 Change your double quotes to single I've actually split the file into a smaller test file and replaced all the "," with ; which is not found in the file anywhere. heres what it looks like now "10 Things I Hate About You;Buena Vista;Out;5.1;LBX",14.99,"PG-13;1999;Comedy;1.85:1;717951004208",1999-10-12 00:00:00,3,2005-12-17 00:00:00 Quote Link to comment https://forums.phpfreaks.com/topic/71044-solved-ereg-help-reg_badbr/#findComment-358008 Share on other sites More sharing options...
ptolomea Posted September 29, 2007 Author Share Posted September 29, 2007 well i dont know why its working like this but I'm getting the information i want so here is my solution if (ereg("^\"(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+)",$currentDKP[$linenum],$regs)){ Quote Link to comment https://forums.phpfreaks.com/topic/71044-solved-ereg-help-reg_badbr/#findComment-358018 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.