Re: Anyone good at regular expressions???
| From: | Jeff Warrington | Date: | Mon, 28 Aug 2000 21:53:59 +0000 |
| Subject: | Re: Anyone good at regular expressions??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14012@lists.php.net to get a copy of this message | ||
In article
<Pine.LNX.4.10.10008231509490.10129-100000@anywhere.atican.com>,
me@hansanderson.com ("Hans H. Anderson") wrote:
or using the POSIX expressions:
if (eregi("[^[:alnum:][:space:]]+",trim($string))) {
ok
else
not ok
Jeff Warrington
> Steve,
>
> I think the easiest thing to do would be use trim() in conjunction with
> ereg_replace():
>
> $new = ereg_replace("[^A-Za-z0-9 ]","",trim($old));
>
> Hans
>
> On Wed, 23 Aug 2000, ssonne wrote:
>
>> I've been stumped for a few days at how to write one expression to do
>> the following...any help is appreciated. I have a name and password
>> form and I want to check that.... only letters a-z and A-Z and numbers
>> 0-9 are allowed, and i'd like to allow the space character, but NOT at
>> the beginning or end of the string
>>
>> I've managed to get it to work, but not in one expression...had to use
>> a few, lol
>>
>> TIA
>> -Steve Sonne
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail:
>> php-general-unsubscribe@lists.php.net For additional commands, e-mail:
>> php-general-help@lists.php.net To contact the list administrators,
>> e-mail: php-list-admin@lists.php.net
>>
>>
>>
>
> Hans Anderson ~ me@hansanderson.com PO Box 426, Missoula, MT 59806 |
> PHP, Search Engines, SQL
> (800)397-9116 / (406)549-6524 | Databases, Flash Multimedia,
> http://www.hansanderson.com | Killer Audio Production,
> http://www.goofiness.com | Minty Fresh Breath.
>
>