Re: suggestions please
by "Darrell King" <darrell(at)webctr.com>
|
| Date: |
Sun, 26 Sep 2004 18:07:18 -0400 |
| To: |
<hwg-techniques(at)mail.hwg.org> |
| References: |
earthlink |
| |
todo: View
Thread,
Original
|
|
Untested, but this is the general idea. The first array holds the patterns
to be searched for (. and ,) while the second holds the replacement values
(<br /> and ' '). I didn't check this for syntax or performance, but you
should be able to use it as a base to start from.
<?php
$text = "Testing. This is a test, isn't it?";
$text = preg_replace (
array ("/\./", "/,/"),
array ("<br />", " "),
$text
);
echo $text;
?>
http://us4.php.net/manual/en/function.preg-replace.php
D
----- Original Message -----
From: "Terry Goode" <tgoode(at)earthlink.net>
To: "HWG Techniques" <hwg-techniques(at)mail.hwg.org>
Sent: Sunday, September 26, 2004 10:57 AM
Subject: suggestions please
I really dont know php that well (that's out of the way)
Ok i am building a web page for a buddy who is a teacher, he wishes to
include from time to time some text , i.e. "thoughts.txt".
He is quite good at getting carried away some times and carries on and on.
What i need help with is how can i have php read in the text file , find
the "."(period) at the end of a sentence and change it into a "line
brake " and change a "," (comma) in to a double space ?
Thanks
--
Terry G.
mailto:tgoode(at)earthlink.net
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.