Many thanks Jeremy!
It seems I should read and process the replaceValue first and then pass it
to SNR macro!
By the way, I think this way I can handle control characters.
Best wishes
Mohammad
On Wednesday, March 6, 2019 at 8:26:31 PM UTC+3:30, Jeremy Ruston wrote:
>
> Hi Mohammad
>
> Sorry I missed your question in the thread. If you're trying to get a
> control character into a string for use in a regexp, you can use a
> construction like this:
>
> <$codeblock code={{{ [[%0a]decodeuricomponent[]addprefix[a]addsuffix[b]]
> }}}/>
>
> The idea is to express the character in the % notation used by URIs, and
> then use the decodeuricomponent filter operator to convert it into the
> corresponding character. In this case, $0a corresponds to the newline
> character (ascii code 10).
>
> Best wishes
>
> Jeremy.
>
> --
> Jeremy Ruston
> [email protected] <javascript:>
> https://jermolene.com
>
> On 6 Mar 2019, at 13:52, Mohammad <[email protected] <javascript:>>
> wrote:
>
> Many Thanks Josiah!
>
> I would appreciate your time teaching us how to use regexp in Tiddlywiki
> and specially here with SNR2.
> For the issue you mentioned, I could not find any solution and Jeremy
> comments did not help me to understand what I should do!
>
> By the way, I thought it is better to choose the flag from interface, so I
> am adding
>
> i: ignore case
> g: find all (global match)
> \b: whole words
> m: multi line mode
>
> So, user can select one or a mixed of them (of course \b is something
> separate here!)
>
> I am not sure if m is useful here, but i and g are used frequently!
>
> --Mohammad
>
>
>
> On Wednesday, March 6, 2019 at 5:10:19 PM UTC+3:30, @TiddlyTweeter wrote:
>>
>> Mohammad & all interested
>>
>> I have done a lot of testing of "s-n-r2". It is very good!
>>
>>
>> *DIFFERENCES FROM NORMAL REGEX*
>>
>> It differs from normal regular expressions in that TiddlyWiki needs to
>> guard itself from eating itself.
>>
>>
>>
>> *It does this by needing the regex to be wrapped in Quote Marks*.
>>
>> The type of quote marks differ according to the use-case.
>>
>> IF a tiddler only contains * ' * then wrapping in * " * will work. And
>> vice-versa.
>>
>>
>> IF a tiddler contains both * ' * and * " * quotes then the match string
>> is easiest enabled by wrapping it: * """regex""" *.
>>
>>
>>
>> *LIMITS*
>>
>> 1 - I have found NO WAY to safely make changes in a tiddler that contains
>> the string * """ *. Those 3 double quotes are likely protecting TW from
>> itself but the regex can't currently cope with them.
>>
>>
>>
>> *That rules out safe s-n-r via regex in many macros.*
>>
>>
>>
>> 2 - SUBSTITUTION. Mohammad and I found out that there is currently no
>> easy way to get Control Codes into output replaces. This is problematic as,
>> for instance, we need to replace * <pre> * with * \n```\n *. BUT in
>> replace the "\n" is only treated as a literal.
>>
>>
>> Best wishes
>> Josiah
>>
>> --
> 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] <javascript:>.
> To post to this group, send email to [email protected]
> <javascript:>.
> Visit this group at https://groups.google.com/group/tiddlywiki.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/4aacaf40-2a40-43f2-a5ce-37a0ad33a1dc%40googlegroups.com
>
> <https://groups.google.com/d/msgid/tiddlywiki/4aacaf40-2a40-43f2-a5ce-37a0ad33a1dc%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/639a3308-4b9f-4ca8-bb3c-2f35166239b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.