[TYPO3-core] RFC Feature #9373: Integrate string replacement to stdWrap
Martin Kutschker
masi-no at spam-typo3.org
Thu May 28 20:48:57 CEST 2009
Oliver Hader schrieb:
>
> 30.search = #a (Cat|Dog|Tiger)#i
> 30.replace = an animal
> 30.useRegExp = 1
Don't use a boolean configuration. Imagine you wanted to add a new
"mode" then you have the same troubles as we have so often. Either
useRegExp turns suddenly into a string like useRegExp=newmode or we add
a useNewMode=1 which clashes with useRegExp=1.
So the IMHO proper way is to have "method" or "mode" property which
defaults to "string", but could be also either "regexp" or "wildcard" (?
and * for shell freaks).
Unclear to me is why # (the TS comment sign) is used in this example as
regexp delimiter.
The regexp options
30.search = #a (Cat|Dog|Tiger)#
30.replace = an animal
30.method = regexp
30.delimiter = #
30.caseSensitive = 1
The delimiters are optional:
30.search = a (Cat|Dog|Tiger)
30.replace = an animal
30.method = regexp
Note that caseSensitive may IMHO be a boolean option as I cannot think
of any way how this could be not a simple yes/no question.
It is a property on its own, because also other search mode could be
case insensitive.
Masi
PS: Although it is nice that the replace is a COA it's not quite in line
with the rest of stdWrap.
More information about the TYPO3-team-core
mailing list