Re: String parsing issue in PHP 4.3.10?

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

 



Steve Brown wrote:
> I'm working on a script that will parse through a long string using
> regexs to pattern match a certain format.  I'm having an issue with a
> '?>' in a string being picked up as an end-of-code character, but only

No need to run it.

?> can be caught by PHP as the end of PHP mode, no matter where you put it
in a string or not.

You can get around this by using something like:

>//        $note_exp = '/\d{1,2} \w{3} \d{4} \d{2}:\d{2}\s?> [!-~ ]+/';
> // COMMENT OUT THIS LINE

$note_exp = '/\d{1,2} \w{3} \d{4} \d{2}:\d{2}\s?' . '> [!-~]+/';

Other possible solutions:
Use ?\> and PHP inside of "" and maybe PHP will interpret that as what you
want.

I'm also not a fan of a single \ inside of '' myself, even if the manual
has finally said it's kosher.  Maybe cuz I'm just old, and remember when
that was not specifically allowed in the manual. :-)

So I'd use \\ everywhere you have \ currently.

Actually, you may be triggering a PHP bug in the string parsing engine, by
using \ instead of \\.

You do realize that \ *IS* one of the two special characters inside of
''s, the other being ' itself, right?...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
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