Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 9th, 2006, 2:00 PM   #1
guess
Programmer
 
Join Date: Feb 2006
Posts: 40
Rep Power: 0 guess is on a distinguished road
preg_replace

I have to write a preg_replace function that must append the second line to the first line if the leading character of the second line is not 0,1,2 or 3.

Quote:
17/02/06 20:27:07: [qsheff], BODY, queue=q-1140200826-533831-95034, recvfrom=82.252.112.136, from=beiindeuhbi@hotmail.com, to=umit.halicilik@bnet.net.tr, subj=`Fantastic teen ass in panties
', spam=` pussyteen ', rule=`(hot )(teen)'
there is a \r\n after "panties". And the leading char of the second line is '

So it must append the second line to the first line.

How can I write that preg_replace function??
guess is offline   Reply With Quote
Old Mar 9th, 2006, 2:13 PM   #2
k4pil
Programmer
 
Join Date: Aug 2005
Location: Leeds - UK
Posts: 69
Rep Power: 4 k4pil is on a distinguished road
don't know how....but your website sounds cool!
k4pil is offline   Reply With Quote
Old Mar 9th, 2006, 2:19 PM   #3
guess
Programmer
 
Join Date: Feb 2006
Posts: 40
Rep Power: 0 guess is on a distinguished road
I am parsing log files about 70000lines.And it is not a CSV file.Can u imagine how hard it is?? and then inserting into a database.And then another script for everykind of search.it was the hardest part because forming dynamic queries is really hard...
guess is offline   Reply With Quote
Old Mar 9th, 2006, 6:06 PM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
While the site sounds like lots and lots of fun, I suggest you edit the content next time.

Hmmm...
[php]preg_replace("/(.*)\r?\n([^0123].*)/", '\1\2', $myString);[/php]
That should do it. Maybe - it's been a while since I played with these.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:55 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC