FW: Re: LOL, preg_match still not working.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I pasted this right from my PHP file, so it is correct. Just to elaborate. I
have tested this until my eyes are bleeding.

Sometimes this works sometimes it doesn't.

One minute !!!##$$ This is a test &&%% will work the way it is supposed to,
the next minute it does not.

It seems that the first time through it is fine, but on the second time and
on it is not.
So if I keep hitting submit on my form with the above string, it will be ok
on the first submit, but on subsequent submits it says there are invalid
characters.

Suffice it to say, it is wonky. It seems like it works when it wants to.

Thanks

-----Original Message-----
From: Janet Valade [mailto:jvalade@xxxxxxxx] 
Sent: February 18, 2007 11:07 AM
To: Beauford
Subject: Re:  Re: LOL, preg_match still not working.

Perhaps the code in your email, that is working for other people, is not 
the same code that you are testing and having problems with. Perhaps you 
should try clipboarding the code from the email into a file to test 
yourself. Perhaps there is a typo in the code you are actually testing, 
so that it is not the same as the code in the email you sent to the 
list. Anyway, you can test that by clipboarding the code from your 
email, like others are doing, and testing it.

Janet


Beauford wrote:

> Mails been down since this morning (sorry, that's yesterday morning).
> Anyway, not sure if this went through, so here it is again. 
> 
> ------
> 
> The bottom line is I want to allow everything in the expression and
nothing
> else. The new line does not seem to be an issue - I can put as many
returns
> as I want, but as soon as I add some punctuation, it falls apart.
> 
> As I said before, the ! and the period from my original example are
reported
> as invalid - as they are in the expression they should be valid, I'm sure
> there are other examples as well, but you can see what the problem is. If
I
> take out the ! and period from my example and leave the new lines in, it
> works fine.
> 
> Thanks
> 
> 
> 
> 
>>-----Original Message-----
>>From: Gregory Beaver [mailto:greg@xxxxxxxxxxxxxxxxx] 
>>Sent: February 17, 2007 12:21 PM
>>To: Beauford
>>Cc: PHP
>>Subject:  Re: LOL, preg_match still not working.
>>
>>Beauford wrote:
>>
>>>Hi,
>>>
>>>I previously had some issues with preg_match and many of 
>>
>>you tried to help,
>>
>>>but the same  problem still exists. Here it is again, if 
>>
>>anyone can explain
>>
>>>to me how to get this to work it would be great - otherwise 
>>
>>I'll just remove
>>
>>>it as I just spent way to much time on this.
>>>
>>>Thanks
>>>
>>>Here's the code.
>>>
>>>	if(empty($comment)) { $formerror['comment'] = nocomments; 
>>>	}
>>>	elseif(!preg_match('|^[a-zA-Z0-9!?@#$%^&*();:_.\\\\ /\t-]+$|',
>>>$comment)) {
>>>				$formerror['comment'] = invalidchars;
>>>	}	
>>>
>>>This produces an error, which I believe it should not.
>>>
>>>Testing 12345. This is a test of the emergency broadcast system.
>>>
>>>WAKE UP!!!!!!
>>
>>Hi,
>>
>>Your sample text contains newlines.  If you wish to allow newlines,
>>instead of " \t" you should use the whitespace selector "\s"
>>
>><?php
>>$comment = 'Testing 12345. This is a test of the emergency 
>>broadcast system.
>>
>>WAKE UP!!!!!!';
>>if(!preg_match('|^[a-zA-Z0-9!?@#$%^&*();:_.\\\\\s/-]+$|', $comment)) {
>>    echo 'oops';
>>} else {
>>    echo 'ok';
>>}
>>?>
>>
>>Try that code sample, and you'll see that it says "ok"
>>
>>What exactly are you trying to accomplish with this 
>>preg_match()?  What
>>exactly are you trying to filter out?  I understand you want to
>>eliminate "invalid characters" but why are they invalid?  I 
>>ask because
>>there may be a simpler way to solve the problem, if you can 
>>explain what
>>the problem is.
>>
>>Thanks,
>>Greg
>>
>>-- 
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
> 
> 


-- 
Janet Valade -- janet.valade.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux