Feature #19347

Integrate string replacement to stdWrap

Added by Oliver Hader about 11 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
TypoScript
Target version:
-
Start date:
2008-09-17
Due date:
% Done:

100%

PHP Version:
5.2
Tags:
Complexity:
Sprint Focus:

Description

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 a ordered list of replacement definitions multiple manipulations could be executed the same time. Additionally it regular expressions can be used if required.

<b>TypoScript example:</b>

20 = TEXT
20 {
  value = There_is_a_cat,_a_dog_and_a_tiger_in_da_hood!_Yeah!
  stdWrap.replacement {
    10 {
      search = _
      replace.char = 32
    }
    20 {
      search = in da hood
      replace = around the block
    }
    30 {
      search = #a (Cat|Dog|Tiger)#i
      replace = an animal
      useRegExp = 1
    }
  }
}

The indexes 10, 20, 30 are just for setting an order on the execution of the replacement. Each subkey "search", "replace" and "useRegExp" has again stdWrap functionality.

(issue imported from #M9373)

0009373.patch View (3.51 KB) Administrator Admin, 2009-05-28 17:49

0009373_typoscript.txt View (333 Bytes) Administrator Admin, 2009-05-28 17:49

0009373_documentation.txt View (1.45 KB) Administrator Admin, 2009-05-28 18:13


Related issues

Related to TYPO3 Core - Feature #19320: Enable ascii for parsefunc-short replacement Closed 2008-09-12

Associated revisions

Revision a36b3738 (diff)
Added by Oliver Hader about 8 years ago

[FEATURE] Integrate string replacement to stdWrap

Allow to search/replace strings, optionally with preg-regex.

Change-Id: I05a067e06cf6d6d664a178c6cf91e17178d691a8
Resolves: #19347
Reviewed-on: http://review.typo3.org/3855
Reviewed-by: Jo Hasenau
Tested-by: Jo Hasenau
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert

History

#1 Updated by Steffen Kamper about 11 years ago

Great!

where is the patch? :D

#2 Updated by Oliver Hader over 10 years ago

One thing should possibly be disabled: The disposal of the "e" (PREG_REPLACE_EVAL) modifiert to evaluate the replacement with PHP...

#3 Updated by Michael Klapper over 10 years ago

Great!

#4 Updated by over 9 years ago

Any news about that? It's pending in core list for 10 months. Discussion seems to have ended without a decision.

#5 Updated by Dmitry Dulepov over 8 years ago

  • Category deleted (Communication)

I would prefer a different, simpler, syntax:

10 = TEXT
10.value = Hello, World!
10.replace = "World", "TYPO3"

or

10.replace = /world/i, "TYPO3"

#6 Updated by Xavier Perseguers over 8 years ago

  • Target version changed from 4.6.0 to 4.6.0-beta1

#7 Updated by Mr. Hudson about 8 years ago

Patch set 1 of change I05a067e06cf6d6d664a178c6cf91e17178d691a8 has been pushed to the review server.
It is available at http://review.typo3.org/3855

#8 Updated by Stefan Neufeind about 8 years ago

Dmitry, I agree that "simplicity" would be nice. But imho a clear separation of search/replace makes it easier to handle. Also this allows us to add additional features/settings later. One of the things that came to my mind (not yet done) would be a "limit"-option.

#9 Updated by Stefan Neufeind about 8 years ago

Solution commited to gerrit now is the original patch, only slightly reworked, and with the eval-modifier stripped.

#10 Updated by Mr. Hudson about 8 years ago

Patch set 2 of change I05a067e06cf6d6d664a178c6cf91e17178d691a8 has been pushed to the review server.
It is available at http://review.typo3.org/3855

#11 Updated by Steffen Gebert about 8 years ago

  • Status changed from Accepted to Under Review
  • Priority changed from Should have to Must have

Review passed, waiting for documentation before merging.

#12 Updated by Steffen Gebert about 8 years ago

  • Category set to TypoScript

#13 Updated by Mr. Hudson about 8 years ago

Patch set 3 of change I05a067e06cf6d6d664a178c6cf91e17178d691a8 has been pushed to the review server.
It is available at http://review.typo3.org/3855

#14 Updated by Mr. Hudson about 8 years ago

Patch set 4 of change I05a067e06cf6d6d664a178c6cf91e17178d691a8 has been pushed to the review server.
It is available at http://review.typo3.org/3855

#15 Updated by Mr. Hudson about 8 years ago

Patch set 5 of change I05a067e06cf6d6d664a178c6cf91e17178d691a8 has been pushed to the review server.
It is available at http://review.typo3.org/3855

#16 Updated by Oliver Hader about 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#17 Updated by Xavier Perseguers over 7 years ago

  • Status changed from Resolved to Closed

#18 Updated by Ernesto Baschny over 6 years ago

  • Target version deleted (4.6.0-beta1)

Also available in: Atom PDF