
ordt:redact-regex( $column as item(), $options as map:map? ) as map:map
This function redacts a string column by applying a regular expression. This function can be used with op:bind or op:select.
| Parameters | |
|---|---|
| $column | The name of the column to be redacted. This can be either a string or the return value from op:col, op:view-col, or op:schema-col. |
| $options | The options for masking the value the column. |
The regular expression is specified similar to the fn:replace function. The options consist of the following required properties:
xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
at "/MarkLogic/optic.xqy";
import module namespace ordt="http://marklogic.com/optic/redaction"
at "/MarkLogic/optic/optic-redaction.xqy";
op:from-view("main", "employees")
=> op:bind((
ordt:redact-regex(op:schema-col("main", "employees", "level"),
map:entry("pattern","^([^:]+):.+$")=>map:with("replacement","$1"))
))
=> op:result()
xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
at "/MarkLogic/optic.xqy";
import module namespace ordt="http://marklogic.com/optic/redaction"
at "/MarkLogic/optic/optic-redaction.xqy";
op:from-view("main", "employees")
=> op:select((
ordt:redact-regex(op:schema-col("main", "employees", "level"),
map:entry("pattern","^([^:]+):.+$")=>map:with("replacement","$1"))
))
=> op:result()
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.