Question: I'm looking to do something like get the opposite match from this line:

```
$input = "21.asdf*234true;asdf0--11"
$_BOOL_ ="/(true|false)/i";
$output = preg_replace($_BOOL_, '', $input);
//Result: "21.asdf*234;asdf0--11"
//Desired result: "true"

```

Which ofcourse in php 5.3 is 

`$output = preg_filter($_BOOL_, '', $input);`

But I'm on 5.2, and not sure how to get what I want here... Suggestions (other than compile 5.3 on ubuntu)?

Answer: 
Your example is still a little vague.

If the string contains EITHER true or false, the output should be "true"?

If that is the case you are looking for `preg_match()` I think.

If you are looking to return either "true" if the string contains true and "false" if it contains false, I think you may have to use a series of functions such as preg\_match() or strpos()to match each condition seperately.
How about:

```
$output = preg_replace($_BOOL_, '', preg_grep($_BOOL_, $input));

```

EDIT: Looking at your question again, I'm not sure we're talking about the same thing. For each string in the input array, `preg_replace` performs any replacements it can and returns the result; any string that doesn't match the regex is passed along unchanged. `preg_filter` is the same, except it discards the strings that don't match the regex. I wouldn't call those opposites. If this isn't what you're looking for, maybe you can provide some examples.