[Phpmyadmin-devel] demo problem (preg_match)

Hi, can someone have a look at the demo problem: 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 This does not happen on my server. Marc

Hi On Saturday 22 of November 2003 14:15, Marc Delisle wrote:
can someone have a look at the demo problem:
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
There is not escaped \ in regex. Michal

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
participants (3)
-
Garvin Hicking
-
Marc Delisle
-
Michal Čihař