|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2000-10-15 11:46 UTC] zibin at tx dot technion dot ac dot il
 everytime I have a regular expression which have ".*" or "[0-9]*" I get the following error:
Warning: REG_BADRPT in /home/websites/www.gigcenter.com/DB.htmlToPHP3.php3 on line 236
For example:
if ( eregi("onlyuser\[(.*?)\]",$inside, $regs) ||
				
if ( eregi("adduser\[(.*?)\]",$inside, $regs) ) {
				
But this doesn't cause error:
if ( eregi("authenticate=(.)",$inside, $regs) )
					$authenticate = $regs[1];
				if ( eregi("MUST Authenticate",$inside) )
thanks for your time.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 10:00:02 2025 UTC | 
I don't believe that this is a bug--those aren't valid POSIX regular expressions. It looks like you're trying to use a perl-style non-greedy operator (?) after the .* piece, which isn't part of the POSIX regex syntax. For more information on POSIX regex syntax, check out the manual page which comes with the PHP source--in PHP 4, it's located in /path/to/php4/regex/regex.7. You can read it by doing something like: % man /path/to/php4/regex/regex.7 If you want to use non-greedy type regexes, you should use the perl- compatible functions; if you want to catch all of the instances found in a string, use preg_match_all(). Something like this: if (preg_match_all('/onlyuser\[(.*?)\]/i', $inside, $regs)) { var_dump($regs); } Check out http://www.php.net/manual/function.preg-match-all.php and the manual entries on syntax and pattern modifiers for more information.Actually, the problem is in the escaping of the [ and ]. The first \ is being eaten by the PHP parser. What you really want is eregi("onlyuser\\\[(.*?)\\\]",$inside, $regs)