[TYPO3-core] RFC Feature #9373: Integrate string replacement to stdWrap

Michael Stucki michael at typo3.org
Thu Jul 23 17:13:14 CEST 2009


Hi Olly,

> Problem:
> With stdWrap it's not possible yet to do (ordered) string replacements
> for processing content data.
> 
> On introducing a new stdWrap property "replacement" that takes an
> ordered list of replacement definitions multiple manipulations could be
> executed the same time. Additionally it regular expressions can be used
> if required.

Very good idea!

> Integrate a new stdWrap proptery "replacement" that has an ordered array
> and defines replacement actions. Each replacement action has the
> properties "search" and "replace". Optionally "useRegExp" can be defined
> to use preg_replace() instead of str_replace() for the replacement. Each
> property has stdWrap functionality.

There's two things that I don't like much:

1) str_replace/preg_replace is called for _every_ replacement pair.
However, both functions would allow to use arrays as search/replacement
values.

2) I agree with Masi that the flag is weird. My suggestion is to split
up str_replace and preg_replace into two separate properties.

> Attached is a TypoScript example and the documentation changes. There's
> one thing that should be discussed: The possibility to use the "e"
> modifier for regular expressions that allows to evaluate PHP code. Maybe
> this has to be configurable...

That would be solved if there were two different properties for
str_replace and preg_replace.

- michael
-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/


More information about the TYPO3-team-core mailing list