Re: Reg Exp Help
| From: | Rick Emery | Date: | Tue, 22 Oct 2002 19:02:01 +0000 |
| Subject: | Re: Reg Exp Help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120963@lists.php.net to get a copy of this message | ||
What happened when you tried:
$cus01a = eregi_replace("[^a-zA-Z\- ]", "",
----- Original Message -----
From: "Zach Curtis" <zach@populus.com>
To: <php-general@lists.php.net>
Sent: Tuesday, October 22, 2002 1:37 PM
Subject: [PHP] Reg Exp Help
I am having difficulty with creating a regular expression. I would like the
reg exp to remove anything other than alphas, dashes, and spaces. For
example,
$data_array["cus01a"] = "Charles A. O'Brian-Brown, Jr.";
if (!empty($data_array["cus01a"]))
$cus01a = eregi_replace("[^a-zA-Z\-]|^[[:space:]]", "",
$data_array["cus01a"]);
echo $data_array["cus01a"];
This result produces, "CharlesAOBrian-BrownJr". I want it to produce
"Charles A OBrian-Brown Jr".
Any thoughts...
Regards.
_________________
Zach Curtis
Programmer Analyst
POPULUS
www.populus.com
_________________
Confidentiality Statement:
This e-mail message and any attachment(s) are confidential and may contain
proprietary information that may not be disclosed without express
permission. If you have received this message in error or are not the
intended recipient, please immediately notify the sender by replying to this
message and then please delete this message and any attachment(s). Any use,
dissemination, distribution, or reproduction by unintended recipients is not
authorized. Thank you.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php