Re: Regular Expression for Search/Replace
| From: | Brad Pauly | Date: | Fri, 16 Jan 2004 17:24:42 +0000 |
| Subject: | Re: Regular Expression for Search/Replace | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-174851@lists.php.net to get a copy of this message | ||
On Fri, 2004-01-16 at 10:21, Brad Pauly wrote:
> On Fri, 2004-01-16 at 10:07, Tobias Engelhardt wrote:
> > That is not possible because the id's are hard-coded in thousands of
> > html-pages. Not a very good idea, i know. It wasn't mine... I *have* to
> > use search/replace. (A script processes each file in the directory)
>
> Ah, I see. I think you could use str_replace (untested):
>
> $a = 'order.php?order_id=';
> $b = 'order_';
> $c = '<a href="order.php?order_id=12345">';
>
> $new = str_replace($a, $b, $c).'.html';
Whewps. I just realized I didn't pull the '>' off the end.
- Brad