ID: 29039 User updated by: info at smithfieldentertainment dot com Reported By: info at smithfieldentertainment dot com Status: Wont fix Bug Type: Documentation problem Operating System: UNIX PHP Version: Irrelevant New Comment:
It seems the only useful information about regular expressions in PHP can be found at: http://us4.php.net/pcre.pattern.syntax PCRE Pattern Syntax. It DOES discuss the { - start min/max quantifier, and the } - end min/max quantifier ... but does not mention any limits on PHP's ability to process strings greater than 255 in length. ------------------- The PHP manual could use additional helpful info on regular expressions. It would also be helpful if the information you've already included was more complete. Limits like {0, 255} ARE important to programmers. I was able to work around it... but it took a few hours to find the limitation in the first place, and several lines of code to work around it once I knew what the problem was. Please either fix PHP, or fix its documentation. Thank you. Previous Comments: ------------------------------------------------------------------------ [2004-07-08 13:19:50] [EMAIL PROTECTED] We have discussed this and we decided not to document this behaviour, has this is cleary explained in the man page. ------------------------------------------------------------------------ [2004-07-06 23:41:14] info at smithfieldentertainment dot com Description: ------------ I sent the following email to Mehdi Achour <[EMAIL PROTECTED]> --------------- Hi, I discovered (the hard way after hours of code troubleshooting) that ereg/eregi/etc. functions have a very useful but LIMITED length function. It seems that while the ereg functions will search for matches in (any?) length code, the length limiter {0, 255} is limited to 255. I was trying to match lengths of 350 and 800� but couldn�t figure out why I was getting an error. There�s no documentation on this anywhere that I could find. Please add it to all applicable regular expression match items that it applies to. Thanks! -- CJ Greiner [EMAIL PROTECTED] http://www.SmithfieldEntertainment.com 757-356-1166 Reproduce code: --------------- if (eregi("^([a-z0-9 $&*?\'.-]{100,300})$", $register_data[register_summary], $ereg_results) == FALSE) { $error_message .= '<br>Subject Summary: Please use only letters, numbers, and punctuation: \'-$&*?<br>'; } Expected result: ---------------- if the user input $register_data[register_summary] does not match the regular expression OR is ouside the acceptable length range of 100-300 letters, then the expression should return FALSE and assign an $error_message. Actual result: -------------- Even when the user input for $register_data[register_summary] had acceptable characters AND had acceptable lengths... The code failed because the max length of 300 {100, 300} was causing a FALSE or FAIL. I experimented with the length until I brought it down to 255... then it worked. This limit is not documented anywhere. There should be no limit... or at least a much higher limit, since the matching expression will work on a much longer string if no length limit is placed in it. Thanks! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29039&edit=1
