[Phpmyadmin-devel] demo problem (preg_match)

Garvin Hicking phpmyadmin at supergarv.de
Thu Dec 4 04:29:06 CET 2003


Hi Marc!

> Warning: Compilation failed: missing terminating ] for character class
> at offset 13 in
> /home/groups/p/ph/phpmyadmin/htdocs/phpMyAdmin/libraries/common.lib.php
> on line 1108

Funny thing. Previously this line was:

 ereg('(^|[^\])(_|%)');

and now it's

 preg_match('@(^|[^\])(_|%)@');

Syntactically spoken, in both cases this should yield an error because
of the either missing ']' or missing '\'.  I guess the correct RegEx
should read:

 preg_match('@(^|[^\\])(_|%)@');

which means, that the current database must have an '_' or '%'
character after either the beginning of the string, or after any
single character apart from '\'. More exactly:

'_database' is true.
'%database' is true.
'x%database' is true.
'ab%database' is false.
'\database' is false.

But, honestly, I don't understand why a single char before '%' or '_'
is allowed, but not more than one? Does anyone get through the logic
of the previous ereg? :-)

BTW: I'm about to finish the rest of my changed code in the next hour.

Regards,
Garvin.

-- 
Garvin Hicking   | Mediengestalter
www.supergarv.de | #ICQ 21392242




More information about the Developers mailing list