1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-02 02:03:14 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/filters/regexp.tid
2015-01-24 21:18:44 +00:00

32 lines
1.5 KiB
Plaintext

created: 20140909134102102
modified: 20150124203736000
tags: [[Filter Operators]] [[Field Operators]] [[Negatable Operators]]
title: regexp Operator
type: text/vnd.tiddlywiki
caption: regexp
purpose: filter the input by pattern-matched field
<$macrocall $name=".operator-def"
input="a [[selection of titles|Title Selection]]"
suffix="the name of a [[field|TiddlerFields]]"
suffixName="f"
parameter="a regular expression"
paramName="x"
output="those input tiddlers in which field <<.place f>> matches <<.place x>>"
negationOutput="those input tiddlers in which field <<.place f>> does <<.em not>> match <<.place x>>"
/>
<<.def "Regular expressions">> are concise strings of characters that denote patterns of text to search for. The format used in ~TiddlyWiki is fully defined in [[this Mozilla reference|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions]].
The [[filter syntax|Filter Run]] makes it impossible to directly specify a regular expression that contains square brackets. The solution is to store the expression in a [[variable|Variables]]. See the <<.operator-examples "regexp" "examples">>.
The parameter <<.place x>> can optionally start or end with a string of flags:
<$railroad text=""" "(?" { ("i"|"m"|:"g") } ")" """/>
Only the `i` flag is generally useful: it forces the different between capital and lowercase letters to be ignored.
If <<.place x>> is empty, <<.op regexp>> will match all of the input tiddlers.
<<.operator-examples "regexp">>