php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #6046 preg_replace for a special pattern
Submitted: 2000-08-09 07:41 UTC Modified: 2001-01-21 03:18 UTC
From: wico at cnh dot nl Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0 Latest CVS (09/08/2000) OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wico at cnh dot nl
New email:
PHP Version: OS:

 

 [2000-08-09 07:41 UTC] wico at cnh dot nl
hiya

if you have a regex that captures more than one pattern i'd to give a argument to the function which to replace

say:
regex: (a)(b)(a)
replace: test

preg_replace("'(a)(b)(a)'", "test", "abaabaaba");
normal preg_replace will replace 'aba' with 'test' outputing: testtesttest

preg_replace_pattern_no("'(a)(b)(a)'", "test", "abaabaaba", 2);
replacing pattern 2 and outputting: atestaatestaatesta

Greetz,

Wico

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-21 03:18 UTC] cynic@php.net
use non-capturing patterns.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu May 08 01:01:27 2025 UTC