Improving regular expression documentation

If someone is quite familular with regexp in TiddlyWiki, is it possible to document the difference between using standard and extended regexp and where it is different or limited in tiddlywiki?

  • The first example most of us are familular with is to set a macro/procedure/variable to the regexp string to use it in filters and bypass the special characters that would break a filter.
  • Another is when using a find vs replace, even find and replace regexp - I dont understand this myself.
  • LLM’s and custom websites are very good at helping construct regular expressions for many things however they do not know about tiddlywiki, so documenting this delta would help.

Lets not forget @Mohammad’s https://tw-regexp.tiddlyspot.com/ mentioned on tiddlywiki.com

Intial references for regularexpressions

split Operator
join Operator
search-replace Operator
search Operator
splitregexp Operator
regexp Operator
escaperegexp Operator

Questions arrising

If you want to search and replace can you use a single regular expression to do both or must you resort to the search-replace operator?

  • If not would this be a useful operator?

If first we want to find tiddlers whos text field has content matching a regular expression we need to return a title. Then for each title we may want to to use further regular expressions to “parse” the text field and return what is found and/or replace.

  • One approach is to input the whole text field then apply a “find and replace”, then save the result to the text field,
    • however the search and replace operator only allows a string replacement, its not possible to craft the string with regexp including backreferences
  • What specific patterns do we need?

The core makes use of Regular expressions to parse text and more and contains within that regular expressions that deserve documentation so others can make solutions with such expressions. It would be greate to document these and where they are in tiddlywiki.

This Topic was inspired by How search for the string, the whole string and nothing but the string? - #12 by pmario,

honorable mention to @Charlie_Veniot tested [tw5] Getting to know regular expressions
Only some people understand this Gron - Make JSON greppable!

There is a lot of Prior art in talk.tiddlywiki but I did not notice any taking this specific perspective.