replacing [[ works successfully
search-replace:g:regexp[\[\[],[<<yt "]
but for ]]
search-replace:g:regexp[\]\]],[>>]
does not seem to work?
replacing [[ works successfully
search-replace:g:regexp[\[\[],[<<yt "]
but for ]]
search-replace:g:regexp[\]\]],[>>]
does not seem to work?
Hi – Have a closer look at: https://tiddlywiki.com/#search-replace%20Operator%20(Examples)
You should define eg:
\define leftEdge() [[
\define rightEdge() ]]
And then use the variables instead of characters. There are some examples that uses a mechanism like this one.
thank you pmario!
here’s what it was used for, for our later reference
<!-- 20231003 this was made for an easily accessible search and replace
following etardiff's example on https://talk.tiddlywiki.org/t/editor-toolbar-button-to-remove-extra-space-and-line-breaks/6873/6
with additional keyboard shortcut functionality (only works if editor toolbar is enabled in settings)
we used ctrl-shift-L (and removed ctrl-shift-L from other shortcuts)
-->
\define rightdoublesquarebracket() ]]
<$vars storeTitle=<<qualify "$:/temp/storeText">> test="\]">
<$action-deletetiddler $filter="[<storeTitle>]" />
<$action-sendmessage
$message="tm-edit-text-operation"
$param="save-selection"
tiddler=<<storeTitle>> field="text" />
<$action-sendmessage
$message="tm-edit-text-operation"
$param="replace-selection"
text={{{ [<storeTitle>get[text]search-replace:g:regexp[\[\[],[<<yt "]search-replace:g:regexp[\|https://youtu\.be/],[" ]search-replace:g:regexp[\|https://www\.youtube\.com/watch\?v=],[" ]search-replace:g:regexp[\|https://m\.youtube\.com/watch\?v=],[" ]search-replace:g:regexp<rightdoublesquarebracket>,[>>]] }}} />
</$vars>
Are you only trying to remove [[ ]]
and replace them with something else?
Trim and prefix operators work but there are other ways,
\define something() [[something else]]
\function a-string(string) [<string>]
\define open() [
\define close() ]
{{{ [<something>trim<open>trim<close>] }}}
<<a-string [[something other]]>>
Example try on tiddlywiki.com, now use addprefix and add suffix as well as needed.
When I have problems like this I change my fences to a slash like this:
search-replace:g:regexp/\]\]]/,/>>/
Also look into using regex testing tools like: