diff --git a/editions/tw5.com/tiddlers/filters/examples/How to remove stop words.tid b/editions/tw5.com/tiddlers/filters/examples/How to remove stop words.tid new file mode 100644 index 000000000..a228e4404 --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/examples/How to remove stop words.tid @@ -0,0 +1,28 @@ +created: 20201118094513209 +modified: 20201118103414384 +tags: [[Operator Examples]] [[search-replace Operator]] [[sortsub Operator]] +title: How to remove stop words +type: text/vnd.tiddlywiki + +\define book-list() +[[A Tale of Two Cities]] +[[The Dice Man]] +[[A New Kind of Science]] +[[The Recursive Universe]] +[[Great Expectations]] +[[Animal Farm]] +\end + +\define compare-without-stopwords() +[search-replace:i:regexp[^The |A ],[]] +\end + +You can use the [[search-replace Operator]] in combination with the [[sortsub Operator]] to ignore stop words like "A" and "The" at the beginning of titles when sorting. (Note for example that "A Tale of Two Cities" sorts under "T" rather than "A") +<<.operator-example 6 "[enlistsortsub]">> + +You can also customise the listing so that "A Tale of Two Cities" is listed as "Tale of Two Cities, A" but still links to the correct tiddler. +< +<$list filter="[enlistsortsub]"> +
  • <$link><$text text={{{[search-replace:i:regexp[(^The |A )(.*)],[$2, $1]]}}}/>
  • + +""">> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/search-replace Operator (Examples).tid b/editions/tw5.com/tiddlers/filters/examples/search-replace Operator (Examples).tid similarity index 91% rename from editions/tw5.com/tiddlers/filters/search-replace Operator (Examples).tid rename to editions/tw5.com/tiddlers/filters/examples/search-replace Operator (Examples).tid index 79c9b60b6..5bcb57509 100644 --- a/editions/tw5.com/tiddlers/filters/search-replace Operator (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/examples/search-replace Operator (Examples).tid @@ -1,5 +1,5 @@ created: 20201107112846692 -modified: 20201107113536230 +modified: 20201118103305351 tags: [[Operator Examples]] [[search-replace Operator]] title: search-replace Operator (Examples) type: text/vnd.tiddlywiki @@ -20,6 +20,7 @@ Replace all matches of a string irrespective of case: <<.operator-example 3 """[[Hello There]search-replace:gi[H],[]]""">> You can also use regular expression capture groups in the replacement string: - `\define names() (\w+)\s(\w+)` -<<.operator-example 4 """[[John Smith]search-replace::regexp,[$2,$1]]""" >> \ No newline at end of file +<<.operator-example 4 """[[John Smith]search-replace::regexp,[$2,$1]]""" >> + +{{How to remove stop words}} diff --git a/editions/tw5.com/tiddlers/filters/examples/sortsub Operator (Examples).tid b/editions/tw5.com/tiddlers/filters/examples/sortsub Operator (Examples).tid index 475413155..ea91205d9 100644 --- a/editions/tw5.com/tiddlers/filters/examples/sortsub Operator (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/examples/sortsub Operator (Examples).tid @@ -1,5 +1,5 @@ created: 20200425110427700 -modified: 20200425110427700 +modified: 20201118103327392 tags: [[sortsub Operator]] [[Operator Examples]] title: sortsub Operator (Examples) type: text/vnd.tiddlywiki @@ -29,4 +29,6 @@ These examples make use of the following variables: <<.operator-example 4 "[!sortsub:numberlimit[10]]">> <<.operator-example 5 "[tag[Field Operators]sortsub:date]">> +{{How to remove stop words}} + \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/toggle Operator (Examples).tid b/editions/tw5.com/tiddlers/filters/examples/toggle Operator (Examples).tid similarity index 100% rename from editions/tw5.com/tiddlers/filters/toggle Operator (Examples).tid rename to editions/tw5.com/tiddlers/filters/examples/toggle Operator (Examples).tid