1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-01 17:53:15 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/filters/FilterOperator regexp.tid

22 lines
1.3 KiB
Plaintext
Raw Normal View History

created: 20140909134102102
modified: 20140909134102102
tags: filters
title: FilterOperator: regexp
type: text/vnd.tiddlywiki
The ''regexp'' filter operator filters tiddlers that match a regular expression.
Regular expressions are a way of encoding complex string matching criteria. The format is defined fully in [[this Mozilla reference|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions]].
The regexp filter operator takes a fieldname as the optional suffix (defaulting to `title`).
The regular expression itself can start or end with an optional string to specify flags in the format `(?flags)` where flags can be "g", "m" or "i". Only the "i" flag is generally useful: it forces the match to be case-insensitive (ie upper and lower case letters are considered the same).
For example:
|!Filter String |!Description |
|`[all[tiddlers]regexp[EggCup]]` |Selects all tiddlers that have the CamelCase string "EggCup" in their title |
|`[all[tiddlers]regexp[eggcup(?i)]]` |Selects all tiddlers that have the string "eggcup" in their title (ignoring case) |
2014-09-09 20:32:11 +00:00
|`[all[tiddlers]regexp[(?i)\.jpe?g$]]` |Selects all tiddlers with titles ending in ".jpg" or ".jpeg" (ignoring case) |
|`[all[tiddlers]regexp:modified[^2014]]` |Selects all tiddlers whose modified field starts with the string "2014" |