PHPackages                             rah/rah\_replace - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. rah/rah\_replace

ActiveTextpattern-plugin[Search &amp; Filtering](/categories/search)

rah/rah\_replace
================

Search and replace plugin for Textpattern CMS

0.5.0(7y ago)1711GPL-2.0PHPPHP &gt;=5.6.0CI passing

Since Apr 25Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/gocom/rah_replace)[ Packagist](https://packagist.org/packages/rah/rah_replace)[ Docs](https://github.com/gocom/rah_replace)[ RSS](/packages/rah-rah-replace/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (3)Versions (4)Used By (0)

rah\_replace
============

[](#rah_replace)

[Download](https://github.com/gocom/rah_replace/releases) | [Packagist](https://packagist.org/packages/rah/rah_replace) | [Issues](https://github.com/gocom/rah_replace/issues)

[Textpattern CMS](https://textpattern.com) template tag that returns contained content with all searched occurrences replaced with given replacements, in the same manner as PHP’s [str\_replace](https://secure.php.net/manual/en/function.str-replace.php) function.

Install
-------

[](#install)

Using [Composer](https://getcomposer.org):

```
$ composer require rah/rah_replace
```

Or [download](https://github.com/gocom/rah_replace/releases) an installer package.

Basics
------

[](#basics)

The plugin, rah\_replace, introduces a new container tag to Textpattern’s arsenal. The tag returns wrapped content with all found occurrences replaced with given replacements. A tag supports multiple searched occurrences and replacements.

```

    Searched content

```

Attributes
----------

[](#attributes)

```

    ...contained statement...

```

The tag is a container and attributes for it follow.

**from**
Strings that will be searched and replaced with `to` attribute’s values. Separate multiple values with a comma (or `delimiter` if changed).
Default: `from=""` Example: `"dog,cat,house"`

**to**
Replacements that will be used to replace `from` attribute’s values. Comma (or `delimiter`) separated if multiple.
Default: `to=""` Example: `"ship,home,hat"`

**delimiter**
Sets the delimiter used in `from` and `to` to separate multiple values. Default is a comma.
Default: `delimiter=","` Example: `"|"`

Examples
--------

[](#examples)

### Replaces a *dog* with a *cat*

[](#replaces-a-dog-with-a-cat)

```

    My favorite animal is a dog.

```

Returns: `My favorite animal is a cat.`

### Replace multiple needles with different replacements

[](#replace-multiple-needles-with-different-replacements)

```

    I live in a house with my dog and Mike.

```

Returns: `I live in a boat with my friend and wife.`

### Replace multiple needles with a one replacement

[](#replace-multiple-needles-with-a-one-replacement)

```

    I remember when dad and Mike did go to fishing.

```

Returns: `I remember when I and I did go to fishing.`

### Using a different delimiter

[](#using-a-different-delimiter)

By default any comma is treated as a delimiter and can not be used as actual value. To use a comma (`,`) as a needle or a replacement, you would have to change the delimiter to something else. Like for instance to a vertical bar:

```

    A, B, C.

```

Returns: `A! B! C!`

Changelog
---------

[](#changelog)

### Version 0.5.0 – 2019/04/06

[](#version-050--20190406)

- Register the tag for Textpattern &gt;= 4.7.0 compatibility.
- Now requires Textpattern &gt;= 4.7.0.

### Version 0.4.2 – 2013/05/07

[](#version-042--20130507)

- The Composer package uses [textpattern/installer](https://packagist.org/packages/textpattern/installer) and [textpattern/lock](https://packagist.org/packages/textpattern/installer).

### Version 0.4.1 – 2013/04/25

[](#version-041--20130425)

- Minor clean up.
- Released as a [Composer package](https://packagist.org/packages/rah/rah_replace).

### Version 0.4 – 2012/07/12

[](#version-04--20120712)

- Performance optimization.

### Version 0.3 – 2011/04/22

[](#version-03--20110422)

- Performance optimization.

### Version 0.2 – 2009/04/16

[](#version-02--20090416)

- Added a new attribute: `delimiter`.

### Version 0.1 – 2009/04/16

[](#version-01--20090416)

- Initial release.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1086 days

Total

3

Last Release

2634d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a34b4e1b662cd2c926e8e89a76f93df266b199fe61508d38026cb952f28e59e?d=identicon)[rah](/maintainers/rah)

---

Top Contributors

[![gocom](https://avatars.githubusercontent.com/u/665186?v=4)](https://github.com/gocom "gocom (19 commits)")

---

Tags

phptextpatterntextpattern-pluginpluginsearchreplacetextpattern

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/rah-rah-replace/health.svg)

```
[![Health](https://phpackages.com/badges/rah-rah-replace/health.svg)](https://phpackages.com/packages/rah-rah-replace)
```

###  Alternatives

[10up/elasticpress

Supercharge WordPress with Elasticsearch.

1.3k387.2k13](/packages/10up-elasticpress)[webdevstudios/cmb2-post-search-field

Custom field for CMB2 which adds a post-search dialog for searching/attaching other post IDs.

6648.1k2](/packages/webdevstudios-cmb2-post-search-field)[10up/debug-bar-elasticpress

Extends the Debug Bar plugin for usage with ElasticPress

2817.3k](/packages/10up-debug-bar-elasticpress)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
