|
Posted by Jim Michaels on 10/13/20 11:39
"yawnmoth" <terra1024@yahoo.com> wrote in message
news:1137648980.011472.98440@f14g2000cwb.googlegroups.com...
> Say I have the following script:
>
> <?
> $string = 'test';
> if (eregi("^[a-z0-9| |\,\-\+\.]+$",$string))
^ means starting from the beginning of the line
[] means match one character in the set between the brackets.
+ after the [] means match 1 or more of those.
$ means must hit the end of the line.
> {
> echo 'matches!';
> }
> else
> {
> echo 'no match';
> }
> ?>
>
> Why does $string = 'te\st' yield a match? The ereg expression doesn't
> have a \\ in it...
>
> Also, what does | | do? Normally, it'd mean 'or', but inside of []'s?
> And two of them?
>
Navigation:
[Reply to this message]
|