I need to read an string to find variables (tags) and replace it with stored values. 
I used % (percent) to identify the tags. The input should accept some tags like %color% and %animal%, so with PHP I need to insert the real string... Better explained with codes:

```
// We have some strings stored
$color = 'white';
$animal = 'cat';

```

The user should use %color%, %animal%, or nothing in the textarea to show the variable he want.

```
// The user text was stored by the $text
$text = "The quick %color% fox jumps over the lazy %animal%.";

```

The %color% and the %animal% of the $text should be replaced by the $color and the $animal values. But, how can I do it? The final output should be

```
<p>The quick white fox jumps over the lazy cat.</p>

```

WordPress allow the users to do this in the "permalink" options, so the users can set, for example, the following extructure:

```
http://localhost/site/%category%/%postname%/

```