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 this is not your bug, you can add a comment by following this link.
If this is your bug, but 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

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-21 03:18 UTC] cynic@php.net
use non-capturing patterns.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 06:01:33 2024 UTC