php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9619 {0,300} returns REG_BADRPT-Warning
Submitted: 2001-03-08 06:59 UTC Modified: 2001-03-13 06:27 UTC
From: zong64 at firemail dot de Assigned:
Status: Closed Package: *Regular Expressions
PHP Version: 4.0.4pl1 OS: Windows 98
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zong64 at firemail dot de
New email:
PHP Version: OS:

 

 [2001-03-08 06:59 UTC] zong64 at firemail dot de
$regex = "^(.*{0,300}[^ ]*).*$";

$txt = eregi_replace($regex,"\\1",$txt);


This Script was written to split a string after 300 lines and the next whitespace. 

Everytime I use it, it returns the following error:
Warning: REG_BADRPT: in f:\www\test.php on line 12

(With PHP4.0.4pl1 and PHP3.?.?)

The critical part of the regex is {0,300}
Values from {0,1} to {0,99} are no problem.
But every Values bigger 99 are returning this error.


I tried to split the regex into:
$regex = "^(.*{0,50}.*{0,50}.*{0,50}.*{0,50}.*{0,50}.*{0,50}[^ ]*).*$" 

But with this regex I only get a white page without any output.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-13 06:27 UTC] dbeu@php.net
the regex will have to look like the following
^(.{0,99}[^ ]*).*$

the ereg functions seem only to support values > 0 & < 100 for the intervals.
use preg_replace instead of eregi_replace.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Dec 07 16:03:34 2021 UTC