Re: Regular expression help
| From: | Ben | Date: | Tue, 25 Nov 2003 21:53:20 +0000 |
| Subject: | Re: Regular expression help | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170948@lists.php.net to get a copy of this message | ||
That's it!
Thank you very much, you have the answer.
I wonder why the programmer did not write the following line instead:
if (strlen(trim($val))) {
// Do the job here
}
Anyways, you just proved that I did not fix the bug! Now I have to work even
more! :-P
Thanks
"Matthias Nothhaft" <php@mahono.de> wrote in message
news:3FC3C9A4.3090002@mahono.de...
> Hi,
>
> ^ inside [] means "not the following chars", so your expression means:
>
> if ($val contains no space " ", no tab "\t" and no newline "\n")
> {
> //do the job ...
> }
>
> Regards,
> Matthias
>
>
>
> Ben wrote:
> > I need someone to tell me exactly what this regular-expression means:
> > if(ereg("[^ \t\n]",$val)) {
> > // do the job here
> > }
> >
> > I'm looking for an intermittent bug, and I need to understand this to
make
> > sure I have found the bug.
> >
> > Thanks
> >