Regex is very powerful and often confusing :-)

For instance ...

*^(([^/]*?)/){1,}[^/]*?$*

Is actually, functionally, the same as the very simple ...

*/*

Test these at: 
http://tw-regexp.tiddlyspot.com/#RegExp%20Experimentation%20with%20Title

The point is whether to have a more complex regex that can do a lot that is 
precise in changing via  *{1,} *or simply match the immediate need that a 
Tiddler needs contain a "/" slash.

Its a pragmatic tool.

TT


On Friday, 6 September 2019 11:38:24 UTC+2, @TiddlyTweeter wrote:
>
> Mohammad wrote:
>>
>> Does this pattern allows trailing slashes?
>>
>
> No. To do that you could use ...
>
> *^(([^/]*?)/){1,}[^/]*?$*
> This makes the negation classes "[^/]*?" matching "not /" of 0 or more 
> length (rather than 1 or more)
> This will match tiddlers ending "/", as well as cases where the title 
> could just be "///"
>
> By the way, if you want to see all titles with "/" use {1,} = 1 or more
>
> ---
>
> But to match that use case only, where you only wanted to list tiddlers 
> with a trailing "/"  use this simple pattern :-) ...
>
> */$*
>
> Part of the art with regex is determining when to be minimal and when to 
> go for something with wider matching power but more complexity.
> The more complex it gets the more important it gets to test against data 
> to be sure it works as expected.
>
> TT
>  
>
>>
>>
>> *Advanced use of the Negated Character Class*
>>>
>>> *Match titles with defined numbers of "/" slash*
>>> *^(([^/]+?)/){1}[^/]+?$*
>>>
>>> The  difference here is in *{1}*
>>>
>>> If you change the number then it will change the number of "/" permitted 
>>> in the match.
>>>
>>> You can test it at: 
>>> http://tw-regexp.tiddlyspot.com/#RegExp%20Experimentation%20with%20Title
>>>  
>>>
>>

-- 
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/7420763d-6b9c-44da-9209-72a2083d5e03%40googlegroups.com.

Reply via email to