Name

p:text-replace — The standard p:text-replace step.

Synopsis

The p:text-replace step replaces all occurrences of substrings in a text document that match a supplied regular expression with a given replacement string.

Input portPrimarySequenceContent types
source✔  text 
Output portPrimarySequenceContent types
result✔  text 
Option nameTypeDefault valueRequired
patternxs:string ✔ 
replacementxs:string ✔ 
flagsxs:string?() 
Declaration
 1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc">
   |   <p:input port="source"
   |            primary="true"
   |            sequence="false"
 5 |            content-types="text"/>
   |   <p:output port="result"
   |             primary="true"
   |             sequence="false"
   |             content-types="text"/>
10 |   <p:option name="pattern" required="true" as="xs:string"/>
   |   <p:option name="replacement" required="true" as="xs:string"/>
   |   <p:option name="flags" as="xs:string?"/>
   |</p:declare-step>
Errors
CodeDescription
err:XC0147It is a dynamic error (err:XC0147) if the specified value is not a valid XPath regular expression.

Description

The p:text-replace step is defined in the XProc 3.0: Standard Step Library. It is also described on XProcRef.org.