Menu

COPYPASTE statement

Rx (9)
Oleg Osepyants

COPYPASTE statement

This statement finds in the text or text fragment the substring corresponding to the first parameter and replaces with it all found substrings corresponding to the second parameter.

Usage

COPYPASTE <CopyString> INTO <PasteString>
COPYPASTE <CopyString> INTO <PasteString> INSIDE OF <ContextArea>
COPYPASTE <CopyString> INTO <PasteString> OUTSIDE OF <ContextArea>

Parameters

  • CopyString - An Rx string specifying the substring to be copied.
  • PasteString - An Rx string that specifies the substrings in the text to be replaced with the copied substring.
  • ContextArea - An Rx string that specifies the Context area (not needed if the statement is running in the global scope).

Examples

Example 1

This statement will replace all occurrences of the [SUBJECT] wildcard with the value from the HTML header (<h1>...</h1>)

COPYPASTE R"(?<=<h1>).*?(?=<\/h1>)" INTO P"[SUBJECT]"

Original text

<h1>Coffee grinder</h1><p>The [SUBJECT] is a complex technical device. To activate the [SUBJECT], insert a plug into a socket and press the "ON" button.</p>

The text after applying the statement above

<h1>Coffee grinder</h1><p>The Coffee grinder is a complex technical device. To activate the Coffee grinder, insert a plug into a socket and press the "ON" button.</p>

Related

Wiki: Rx text transformation script language

MongoDB Logo MongoDB