RE: [PHP] Reg Exp Help
| From: | Zach Curtis | Date: | Tue, 22 Oct 2002 19:41:13 +0000 |
| Subject: | RE: [PHP] Reg Exp Help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120974@lists.php.net to get a copy of this message | ||
Terrific. That works.
Thank you.
Zach
-----Original Message-----
From: 1LT John W. Holmes [mailto:holmes072000@charter.net]
Sent: Tuesday, October 22, 2002 1:42 PM
To: Zach Curtis; Rick Emery; php-general@lists.php.net
Subject: Re: [PHP] Reg Exp Help
the - character must be the last one in the brackets. Put the space before
it.
[^a-zA-Z -]
You don't need the \ unless you mean a literal \.
---John Holmes...
> Yeah, I also tried a space after the \- (of the many combinations I have
> tried) which produces:
>
> "Warning: REG_ERANGE"
>
>
> Zach
>
> -----Original Message-----
> From: Rick Emery [mailto:remery@emeryloftus.com]
> Sent: Tuesday, October 22, 2002 1:02 PM
> To: Zach Curtis; php-general@lists.php.net
> Subject: Re: [PHP] Reg Exp Help
>
>
> 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
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>