delete-text(pattern
,flags
?,from
?)
Delete text matching regular expression pattern
from node from
. Parameter from
defaults to the context node. The text is deleted no matter the node containing it: node from
, descendants of node from
or a mix between node from
and its descendants.
Optional flags
may be used to parametrize the behavior of the regular expression:
a
Delete all occurrences of pattern
.
m
Operate in multi-line mode. In multi-line mode, the expressions ^
and $
match just after or just before, respectively, a line terminator or the end of the input sequence. By default, these expressions only match at the beginning and the end of the entire input sequence.
s
Operate in single line mode. In single line mode, the expression .
matches any character, including a line terminator. By default, this expression does not match line terminators.
i
Operate in case-insensitive mode (in a manner consistent with the Unicode Standard).
l
Treat the pattern as a sequence of literal characters.
Regular expression reference: java.util.regex.Pattern
.
Examples:
delete-text("Note:\s*"); delete-text("\n", "as"); delete-text("^\s+", "", $div);