Regexp
| From: | David Balatero | Date: | Fri, 30 Mar 2001 01:41:14 +0000 |
| Subject: | Regexp | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-46214@lists.php.net to get a copy of this message | ||
I am reading in a comments file from a Perl program I have been using, and I
will be converting the comments' text files into a MySQL database...but that
is unimportant. In the files, I have something (after i strip_tags()) like
this:
##################
$file = "
# 4
Name:
Vigilante
E-mail:
jcarpen1@maine.rr.com
Date:
Monday, July 24, 2000, 5:28 PM
ip:
Hidden
Comment
Hmm. Even that link doesn't work anymore. Looks like they took that
comic down (booo). Anyone save it?
# 3
Name:
Anonymous Unregistered
E-mail:
redel@prairie.nodak.edu
Date:
Monday, July 24, 2000, 8:57 AM
ip:
209.181.217.205
Comment
http://www.pvponline.com/archive.php3?archive=20000723
The URL changed because it was yesterday's comic :)
";
###################
What I want to do is break it down so it looks like this (NOTE: "``````x"
would be the break between comments)
################
$file = "
# 4
Name: Vigilante
E-mail:jcarpen1@maine.rr.com
Date:Monday, July 24, 2000, 5:28 PM
ip:Hidden
Comment:Hmm. Even that link doesn't work anymore. Looks like they took that
comic down (booo). Anyone save it?
``````x
# 3
Name:Anonymous Unregistered
E-mail:redel@prairie.nodak.edu
Date:Monday, July 24, 2000, 8:57 AM
ip:209.181.217.205
Comment:http://www.pvponline.com/archive.php3?archive=20000723<br>The
URL
changed because it was yesterday's comic :)
";
#################
Then I could parse it easier. So, I guess i need a regexp to remove all the
\n and :space: chars.
Thanks,
David Balatero