RE: [PHP] ereg($var1."|", $var2) --> What's wrong with it?,.., | (pipe) gives an error...
| From: | Maxim Maletsky | Date: | Wed, 06 Sep 2000 13:19:23 +0000 |
| Subject: | RE: [PHP] ereg($var1."|", $var2) --> What's wrong with it?,.., | (pipe) gives an error... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-15526@lists.php.net to get a copy of this message | ||
Cheers!
I kinda knew it , but since I did never use eregs too much (usually used
already prepared algorithms) I did not notice that | is special in it....
Thanks to you all!
-----Original Message-----
From: Monte Ohrt [mailto:monte@ispi.net]
Sent: Wednesday, September 06, 2000 10:16 PM
To: Maxim Maletsky
Subject: Re: [PHP] ereg($var1."|", $var2) --> What's wrong with it?,..,
| (pipe) gives an error...
| has special meaning (or) in a regular expression. escape it with a \
ereg($var1."\|", $var2)
Maxim Maletsky wrote:
>
> Hi,
> maybe it is obvious or something, but I cannot understand why
>
> ereg($var1."|", $var2)
>
> and
>
> $var1=$var1.'|';
> ereg($var1, $var2)
>
> don't work giving me the message:
>
> Warning: REG_EMPTY in test.php on line 65
>
> while
>
> ereg($var1, $var2)
>
> and
>
> $var1=$var1;
> ereg($var1, $var2)
>
> working perfectly?
>
>
> I use pipe as a separator, and I though it is nothing else then a
> character...
> but here... in ereg()... strange things ARE happening...
>
> I guess that ( | ) cannot be used in ereg() (and maybe anywhere else?)
even
> as a string in single quotes...
>
> I mean even
> echo '$a_variable<br>';
> would output
> $a_variable<br>
> just as it reads above, single quotes are NOT parsed, are they?
>
> why ' | ' ?
>
> Thanks in Advance...
>
> Maxim Maletsky - maxim@j-door.com
> <mailto:maxim@j-door.com>
> Webmaster, J-Door.com / J@pan Inc.
> LINC Media, Inc.
> TEL: 03-3499-2175 x 1271
> FAX: 03-3499-3109
>
> http://www.j-door.com
> <http://www.j-door.com/>
> http://www.japaninc.net
> <http://www.japaninc.net/>
> http://www.lincmedia.co.jp <K<�
> 6&�Ó˜�/Ðhttp://www.lincmedia.co.jp/>
>
>
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/