Mat, chat GPT will probably be a huge help to find regex expression :) Here's one that match the example you gave:
\[\[([^\[\]]+)(?![\s\S]*\]) Try it : https://regex101.com/r/eHsUg1/1 Explanation given by chat GPT: To match the text immediately after [[ in a string, but only if it is not followed by ]] anywhere in the following text, you can use the following regular expression: \[\[([^\[\]]+)(?![\s\S]*\]\]) This regular expression uses the following elements: - \[\[ matches two literal square brackets - ([^\[\]]+) matches one or more characters that are not square brackets ([^\[\]]) and captures the match as a group - (?![\s\S]*\]\]) is a negative lookahead assertion that matches a location in the string only if it is not followed by ]] anywhere in the following text ([\s\S]* matches any character, including newlines, zero or more times) The regular expression will match the text immediately after the opening square brackets, provided that it is not followed by the closing square brackets anywhere in the following text. The matched text will be captured as a group, so you can access it using a capturing group (e.g. $1 in some programming languages). For example, in the string There was a [[cat in a hat]] that [[sat on the mat the regular expression would match cat in a hat as a group. On Saturday, 11 April 2020 at 14:31:19 UTC+2 Mat wrote: > Lin Onetwo wrote: >> >> In notion's latest version, when you type / , a dowpdown menu full of >> searchable macros are shown at caret position. Several other note app also >> adapt this design. If you can achieve this, it would be great! >> > > I have a thread here > <https://groups.google.com/forum/#!topic/tiddlywikidev/scGK9fBKsZ8> that > hopefully leads to somewhere. > > > And maybe I can help with Regex, I'm quite good at that. >> > How do you develop your plugin? I didn't find the Github link. >> > > Your help is more than welcome! > I do my work directly in TW. Typically directly on tiddlyspot. I made > SideEditor <http://sideeditor.tiddlyspot.com/> to let me see the output > "live", but it definitely has flaws. One day EditorMagic will help even > more ;-) > > I have decided to deal with one issue at a time so the first "magic" to > get to work is *title completion *so I set up > http://titlepicker.tiddlyspot.com It works to some extent but the regexps > need improvement... or maybe it is the way the string operators work in TW. > I can't quite tell. I'll start a new thread and I hope you can participate. > > <:-) > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/534cf329-e9a8-4f28-b181-c90707046469n%40googlegroups.com.

