Which syntax to choose for a text cleanup function?

I’m doing loads of queries based upon lists and tasks where each item might have extra information in addition to the text in form of inline fields, tags, links or shortform task information, like in the following example task:

- [ ] #task Some taggy  and [[linked]] task 📅 2023-05-02 

I’m contemplating on building a function for dataview to strip out the bits and pieces I don’t want, but I’m wondering on which syntax to use for cleaning out the extra information.

Which syntax would you like to select the different elements to remove?

Given a query like the one below, how you like to write it to remove the tags and shortform dates from a task like the one above?

```dataview
TASK
WHERE file = this.file
FLATTEN remove(text, ... ) as visual
```

What you would write instead of ...? Some examples I’ve thought about:

  • "tags", "shortform"
  • "tags|shortform"
  • "tags, shortform"
  • list("tags", "shortform")
  • All of the above but with some abbreviations or one letter codes?
  • Given one letter codes, one could also consider "TS". But is that user friendly?

The syntax needs to be something acceptable in a query specification as is, and I would need either abbreviations or letter codes or … for at least these categories:

group example text letter
tags #myTag "tag" T or #
links [[ … ]] "link" L
URLs or other links? https://… "url" U
shortform dates :date: 2023-05-02 "sdate" D
inline fields with key [ … :: … ] "field" ? F or [
without key ( … :: … ) "field"? F or (

And should I provide options for spacers to be removed? I see some like to do stuff like [[Some link]] || [[Another link]] or #tagA, #tagB; where the first examples uses || as a spacer, and the other .


So there are three questions hidden here:

  • What should I call the function? remove? clean? something else
  • How should it look when calling it? Some text/letter variation, …
  • Should I implement something related to spacers? And how should that look?

I know how to code this function using variants of regexreplace(), but I would really like your help (even if you don’t know coding) on what kind of syntax to use for such a function! What would be the easier and better way to remember and use such function in our task queries?