Re: [tw5] Re: Tiddlywiki and regexp

2019-09-17 Thread @TiddlyTweeter
Right.

Its clean when you have consecutive items.

I'm trying to work out what to do when you don't.

TT

On Tuesday, 17 September 2019 13:56:22 UTC+2, TonyM wrote:
>
> Yt?
>
> In this case I was extracting all list items from a more complex html 
> source then relisting the items.
> The result is clean with only list items.
>
> Regards
> Tony
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/721b9616-6ac5-46ef-bc9c-1115e8c46e56%40googlegroups.com.


Re: [tw5] Re: Tiddlywiki and regexp

2019-09-17 Thread TonyM
Yt?

In this case I was extracting all list items from a more complex html source 
then relisting the items.
The result is clean with only list items.

Regards
Tony

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a614eb08-5a88-4f93-9284-140b022e6f6b%40googlegroups.com.


Re: [tw5] Re: Tiddlywiki and regexp

2019-09-17 Thread @TiddlyTweeter
Ciao Mark

I'm late on this. I got really interested in this kind of extraction, which 
I think there is demand for.

Two issues I can't figure out ...

1 - does "<$vars realchars="[^\s]+">" need to be that? Rather than its 
inverse "<$vars realchars="\S+">"? (Where you would not need the variable 
as no need for 
"[...]"??)

2 - WHEN you have text BETWEEN tags, is there a way to dump it?

Only if you have time and interest!

Best wishes
TT 


Mark S. wrote:
>
> Actually, the tool we have for regexp is also a bit lacking. There's no 
> tool for directly lifting desired target text. The new splitregexp only 
> splits, it doesn't 
> return the text we want to find. Here's my version that does most 
> literally what you ask for
>
> <$vars realchars="[^\s]+">
> <$list filter="[{test}splitregexp[\n]join[ ]splitregexp[
> ]butfirst[1]splitregexp[]butlast[1]regexp]">
>
> 
> 
>
> Input:
>
> More text here
> line 3
> line 2
> line 1
> More text there
>
> Output
>
>
> line 3 
> line 2 
> line 1 
>
>
>
> Good luck!
>
> On Thursday, August 22, 2019 at 2:21:34 AM UTC-7, TonyM wrote:
>>
>> Jeremy,
>>
>> You are aware I do not want so much to parse it as locate the content 
>> between matching tags.
>>
>> Its intention is to access content delimited by html tags inside the text 
>> content.
>>
>> Perhaps we could use it to retrieve items between the section div tags or 
>> all instances of text between the li tags.
>>
>> Regards
>> Tony
>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/fb977184-2b39-4666-a3b7-4a1100f51afb%40googlegroups.com.


Re: [tw5] Re: Tiddlywiki and regexp

2019-09-17 Thread @TiddlyTweeter
TonyM

It makes great sense to throw away unneeded text BETWEEN tags.

Unfortunately I could not get your version to work.

As far as I can see it just re-adds tags you just took off, and also adds 
them to text you need to excise.

Yes?

TT

On Sunday, 25 August 2019 05:50:46 UTC+2, TonyM wrote:
>
> Mark,
>
> Thanks for this, I only just got to test this; A Test tiddler as follows 
> is not working as I may expect it
> zfdtshwfthf
> Content
> sfghn
> Content2
>
> sfghsfgh
> Content3
> sxgfhfgsdh
>
> I would have hoped it would return
> Content
> Content2
> Content3
>
>
> If it was to return only the content between the ` and ` and not 
> any other content from the test tiddler I could do this;
> \define output()
> <$vars realchars="[^\s]+">
> <$list 
> filter="[{test data}splitregexp[\n]join[ 
> ]splitregexp[]butfirst[1]splitregexp[]butlast[1]regexpaddprefix[]addsuffix[]]"
> >
>
> 
> 
> \end
> <$wikify name=result text="<>">
> <>
> 
> Which would find all list items in test (HTML copied from somewhere) and 
> create a new list of only list (li) items in the HTML
>
> Does that make sense?
>
> Regards
> Tony
>
> On Friday, August 23, 2019 at 2:08:20 AM UTC+10, Mark S. wrote:
>>
>> Re your 2nd question, you can make the filter slightly more robust:
>>
>> [{test}splitregexp[\n]join[ ]splitregexp[]butfirst[1]splitregexp
>> []butlast[1]regexp]
>>
>> Re your 1st question, I don't believe you can do this in a single filter. 
>> It will probably take multiple lines if possible at all. Because, there are 
>> no core tools
>> for grabbing the actual text you want -- only for splitting. People have 
>> done a lot with splitting, but it gets tedious.
>>
>> If you had a regular expression filter that could split and return groups 
>> (e.g. #2963) then you could simply search for and lift out the  
>> group and the content group in one regular expression.
>>
>> On Thursday, August 22, 2019 at 7:58:06 AM UTC-7, TonyM wrote:
>>>
>>> Mark - Wow,
>>>
>>> I will test it out tomorrow to see how far I can take it. 
>>>
>>> I hope it works for multi-line tags
>>>
>>> My interest would be also the option to return
>>> line 3
>>> line 2
>>> line 1
>>> or
>>> line 3
>>> line 2 
>>> line 1 
>>> Because keeping the valid tags can be made use of as well.
>>>
>>> Ahd also see how to handle If the list tag had a style eg >> style="something"> it would be nice if we could return
>>> line 1
>>> or
>>> line 1
>>>
>>> If so a lot can be done to extract useful content from html, even if 
>>> just to summarise some content.
>>>
>>> Perhaps further resolution would help like >> name=extract>content
>>>
>>> Or extract list items.
>>>
>>> Even without using html a tiddlers text field could use html block and 
>>> inline elements https://www.w3schools.com/html/html_blocks.asp to 
>>> structure the content, and with such a regex macro extract parts of the 
>>> tiddler text such as say a prepared extract from the content, or an 
>>> excerpt, or a config settings or more.
>>>
>>> Regards
>>> Tony
>>>
>>>
>>> On Friday, August 23, 2019 at 12:22:47 AM UTC+10, Mark S. wrote:


 There's that saying, "When all you have is a hammer, everything starts 
 to look like a nail."

 All we have is regex. It would be great to have some other tool for 
 extracting actual DOM-like structures the way you
 could with TW classic. But we don't have it.

 Actually, the tool we have for regexp is also a bit lacking. There's no 
 tool for directly lifting desired target text. The new splitregexp only 
 splits, it doesn't 
 return the text we want to find. Here's my version that does most 
 literally what you ask for

 <$vars realchars="[^\s]+">
 <$list filter="[{test}splitregexp[\n]join[ ]splitregexp[
 ]butfirst[1]splitregexp[]butlast[1]regexp]">

 
 

 Input:

 More text here
 line 3
 line 2
 line 1
 More text there

 Output


 line 3 
 line 2 
 line 1 



 Good luck!

 On Thursday, August 22, 2019 at 2:21:34 AM UTC-7, TonyM wrote:
>
> Jeremy,
>
> You are aware I do not want so much to parse it as locate the content 
> between matching tags.
>
> Its intention is to access content delimited by html tags inside the 
> text content.
>
> Perhaps we could use it to retrieve items between the section div tags 
> or all instances of text between the li tags.
>
> Regards
> Tony
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Re: [tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-06 Thread @TiddlyTweeter
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/7420763d-6b9c-44da-9209-72a2083d5e03%40googlegroups.com.


Re: [tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-06 Thread @TiddlyTweeter
Mohammad wrote:
>
>  At https://regex101.com/ the below syntax return errors it needs the 
> slash character to be escaped!
>

Mark's detailed answer to why that happens (and why it is *not *an issue in 
TW) is really clear.

I think it may be worth adding a note about the way that TW relates to the 
underlying JS regex engine. 
Tools like TW that access the engine usually use an interface that is 
defined  by the end programmers.

Its part of the same issue of understanding how the "scope" flags "g" and 
"m" are invoked in TW. 
This can be important in matching in the text field, which TW can do, but 
needs a bit more documentation to be optimally used.

TT 

On Friday, 6 September 2019 06:29:13 UTC+2, Mark S. wrote:
>
> There's a difference in javascript between a regular expression, and a 
> string that can be interpreted as a regular expression.
>
> If you notice at regex101, the input box has* / *at the start and end. So 
> it's assuming a direct regular expression, like:
>
> */*^(([^/]+?)/){1}[^/]+?$*/*gm
>
> The slashes are used to indicate the start and end of the expression, and 
> so any slashes in the middle not part of a character class throw an error.
>
> But we're actually passing a string here. So internally something like 
> this is happening:
>
> var patt = new RegExp(*"^(([^/]+?)/){1}[^/]+?$"*) ;
>
> Since the forward slash is not needed to delimit the expression when the 
> regular expression is created this way, it doesn't throw an error inside of 
> TW.
> It's unfortunate that the tool at regex101 doesn't allow you to enter the 
> expression as a string.
>
> -- Mark
>
>>
>> *Advanced use of the Negated Character Class*
>>>
>>> *Match titles with defined numbers of "/" slash*
>>> *^(([^/]+?)/){1}[^/]+?$*
>>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e6bd5cbe-1b1c-4e8f-b53d-3504d05546e5%40googlegroups.com.


Re: [tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-06 Thread @TiddlyTweeter
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/5dff1cfa-c637-4321-a4b0-0e0724659901%40googlegroups.com.


Re: [tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-06 Thread @TiddlyTweeter
Ciao Mohammad

As it is it has little utility. I included it for learning purposes. A very 
simple case that illustrates what Negative Classes do.

I don't know how much regex users have, so I think for docs its useful to 
give some really simple examples and then build from them.

Best wishes
TT

Mohammad wrote:
>
>  How we can use this in a real case? Not starting with $ sign means all 
> ordinary tiddlers!
>
>>
>> Match titles NOT starting "$"
>>
>> *^[^\$]*
>>
>>
>> *"^"* = start of scope, in this case the start of the title field
>> *"[^"* = inside a character class, in first position, *"^"* means "match 
>> the negation" of the following character(s)
>> *"\$"* = match the character "$" literally
>> *"]" *= close character class
>>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/2d85f848-ec55-4148-b1c9-17d8ee477d6c%40googlegroups.com.


Re: [tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-05 Thread Mohammad Rahmani
Hi Mark,

Thanks for clarification!


Best wishes
Mohammad


On Fri, Sep 6, 2019 at 8:59 AM 'Mark S.' via TiddlyWiki <
tiddlywiki@googlegroups.com> wrote:

> There's a difference in javascript between a regular expression, and a
> string that can be interpreted as a regular expression.
>
> If you notice at regex101, the input box has* / *at the start and end. So
> it's assuming a direct regular expression, like:
>
> */*^(([^/]+?)/){1}[^/]+?$*/*gm
>
> The slashes are used to indicate the start and end of the expression, and
> so any slashes in the middle not part of a character class throw an error.
>
> But we're actually passing a string here. So internally something like
> this is happening:
>
> var patt = new RegExp(*"^(([^/]+?)/){1}[^/]+?$"*) ;
>
> Since the forward slash is not needed to delimit the expression when the
> regular expression is created this way, it doesn't throw an error inside of
> TW.
> It's unfortunate that the tool at regex101 doesn't allow you to enter the
> expression as a string.
>
> -- Mark
>
>
>
> On Thursday, September 5, 2019 at 8:48:08 PM UTC-7, Mohammad wrote:
>>
>> TT,
>>  At https://regex101.com/ the below syntax return errors it needs the
>> slash character to be escaped!
>>
>> Please have a look
>>
>>
>> Best wishes
>> Mohammad
>>
>>
>> On Thu, Sep 5, 2019 at 4:05 PM @TiddlyTweeter 
>> wrote:
>>
>>> *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
>>>
>>>
>>> TT
>>>
>>> --
>>> 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 tiddl...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/tiddlywiki/166333e8-b354-47a0-b685-b47886566827%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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 tiddlywiki+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/7262fe0a-4a4b-402f-a094-f0cf3ee6f94f%40googlegroups.com
> 
> .
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMBk6Hk3Z_Q5Rx%2B576zU_NqD8ydW7WMD1hcb4U3C_fhAJw%40mail.gmail.com.


Re: [tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-05 Thread 'Mark S.' via TiddlyWiki
There's a difference in javascript between a regular expression, and a 
string that can be interpreted as a regular expression.

If you notice at regex101, the input box has* / *at the start and end. So 
it's assuming a direct regular expression, like:

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

The slashes are used to indicate the start and end of the expression, and 
so any slashes in the middle not part of a character class throw an error.

But we're actually passing a string here. So internally something like this 
is happening:

var patt = new RegExp(*"^(([^/]+?)/){1}[^/]+?$"*) ;

Since the forward slash is not needed to delimit the expression when the 
regular expression is created this way, it doesn't throw an error inside of 
TW.
It's unfortunate that the tool at regex101 doesn't allow you to enter the 
expression as a string.

-- Mark



On Thursday, September 5, 2019 at 8:48:08 PM UTC-7, Mohammad wrote:
>
> TT,
>  At https://regex101.com/ the below syntax return errors it needs the 
> slash character to be escaped!
>
> Please have a look
>
>
> Best wishes
> Mohammad
>
>
> On Thu, Sep 5, 2019 at 4:05 PM @TiddlyTweeter  > wrote:
>
>> *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 
>>
>> TT
>>
>> -- 
>> 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 tiddl...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/tiddlywiki/166333e8-b354-47a0-b685-b47886566827%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/7262fe0a-4a4b-402f-a094-f0cf3ee6f94f%40googlegroups.com.


Re: [tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-05 Thread Mohammad Rahmani
More question:
Does this pattern allows trailing slashes?


Best wishes
Mohammad


On Thu, Sep 5, 2019 at 4:05 PM @TiddlyTweeter 
wrote:

> *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
>
> TT
>
> --
> 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 tiddlywiki+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/166333e8-b354-47a0-b685-b47886566827%40googlegroups.com
> 
> .
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMAifDHzCj-JQTAzpv8KEur%3DJuBQx5yT-xoatc%2B4rdsMyQ%40mail.gmail.com.


Re: [tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-05 Thread Mohammad Rahmani
TT,
 At https://regex101.com/ the below syntax return errors it needs the slash
character to be escaped!

Please have a look


Best wishes
Mohammad


On Thu, Sep 5, 2019 at 4:05 PM @TiddlyTweeter 
wrote:

> *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
>
> TT
>
> --
> 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 tiddlywiki+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/166333e8-b354-47a0-b685-b47886566827%40googlegroups.com
> 
> .
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMD0_KsKAru210E04dtRKJBtYAHeKtsk78BGR_KZe3aZxA%40mail.gmail.com.


Re: [tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-05 Thread Mohammad Rahmani
TT,
 How we can use this in a real case? Not starting with $ sign means all
ordinary tiddlers!


Best wishes
Mohammad


On Thu, Sep 5, 2019 at 3:06 PM @TiddlyTweeter 
wrote:

> *Example of using the Negated Character Class*
>
> Very useful regex syntax. Often much more economical than using a positive
> character class.
>
> Match titles NOT starting "$"
>
> *^[^\$]*
>
>
> *"^"* = start of scope, in this case the start of the title field
> *"[^"* = inside a character class, in first position, *"^"* means "match
> the negation" of the following character(s)
> *"\$"* = match the character "$" literally
> *"]" *= close character class
>
> To use this in a filter the regex pattern needs to be put into a variable
> and then invoked. See example here:
> https://groups.google.com/d/msg/tiddlywiki/TOUdt8ZjTa4/5v3wiF6fAQAJ
>
> You can test it at Mohammad's regex documentation site:
> http://tw-regexp.tiddlyspot.com/#RegExp%20Experimentation%20with%20Title
>
> TT
>
> --
> 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 tiddlywiki+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/51b95aba-4633-421f-a3f4-792669912fac%40googlegroups.com
> 
> .
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMAZTCNmxs5heSrT2-1PVc6vL_q85x9u8L2EWn7-oG5rjQ%40mail.gmail.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-05 Thread @TiddlyTweeter
if you test this ...
*^(([^/]+?)/){0}[^/]+?$*

You will see only titles without any preceding "/" slash using "*{0}*". 

The combination of negated classes, *[^...]* with exact match numbers *{n}, 
*is often very useful.

TT

On Thursday, 5 September 2019 13:35:50 UTC+2, @TiddlyTweeter wrote:
>
> *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 
>
> TT
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/07b7763c-78a7-4fa3-9785-b53e2487fb1e%40googlegroups.com.


Re: [tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-05 Thread Mohammad Rahmani
This is great to be able to experiment at tw-regexp when you give a new
example.
So, I highly recommend to test and lets user try it at tw-regexp.

Cheers
Mohammad



On Thu, Sep 5, 2019 at 4:05 PM @TiddlyTweeter 
wrote:

> *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
>
> TT
>
> --
> 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 tiddlywiki+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/166333e8-b354-47a0-b685-b47886566827%40googlegroups.com
> 
> .
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMBDdKknspBT5icmHqZ2kQSABT5n60mi-OLQg9BXE%2B7pvg%40mail.gmail.com.


Re: [tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-05 Thread Mohammad Rahmani
Thanks TT.
I will add these to tw-regexp.

Yes, we did not focus on negated character which can be helpful in many use
cases.


Best wishes
Mohammad


On Thu, Sep 5, 2019 at 4:05 PM @TiddlyTweeter 
wrote:

> *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
>
> TT
>
> --
> 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 tiddlywiki+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/166333e8-b354-47a0-b685-b47886566827%40googlegroups.com
> 
> .
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMCHWQVxqdfQmq%2BBk6K%2B3Vg%2BYVYBGNoNKNYdgLf_MyAQPw%40mail.gmail.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-05 Thread @TiddlyTweeter
*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 

TT

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/166333e8-b354-47a0-b685-b47886566827%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-05 Thread @TiddlyTweeter
*Slightly more advanced use of the Negated Character Class*

*Match titles with only ONE "/" slash*
*^[^/]+?/[^/]+?$*

This is useful for people who use the "/" hierarchy in TW for naming 
Tiddlers.

*"^"* = start of scope 
*[^/]+?* = do NOT match "/" one or more times (lazy)
*"/" *= match "/" once
*"[^/]+?"* = do NOT match "/" one or more times (lazy)
*"$"* = end of scope

You can test this at: 
http://tw-regexp.tiddlyspot.com/#RegExp%20Experimentation%20with%20Title

TT

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/133fbdef-70e0-4766-abbd-16f75a867a94%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-05 Thread @TiddlyTweeter
*Example of using the Negated Character Class*

Very useful regex syntax. Often much more economical than using a positive 
character class.

Match titles NOT starting "$"

*^[^\$]*


*"^"* = start of scope, in this case the start of the title field
*"[^"* = inside a character class, in first position, *"^"* means "match 
the negation" of the following character(s)
*"\$"* = match the character "$" literally
*"]" *= close character class

To use this in a filter the regex pattern needs to be put into a variable 
and then invoked. See example here: 
https://groups.google.com/d/msg/tiddlywiki/TOUdt8ZjTa4/5v3wiF6fAQAJ

You can test it at Mohammad's regex documentation site: 
http://tw-regexp.tiddlyspot.com/#RegExp%20Experimentation%20with%20Title

TT

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/51b95aba-4633-421f-a3f4-792669912fac%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-05 Thread @TiddlyTweeter
*Match titles that within words include 3 or more repeated "word" 
characters*

*\B(\w)\1{2,}\B*

*"\B"* = NOT a word-boundary. It is an "anchor" of no size. It is 
complementary to *"\b"* the anchor for word-boundary. "\B" will ONLY match 
*inside 
*"words".
*"\w"* = any single "word" character, i.e. [a-zA-Z0-9_]
*"\1"* = repeat match using character captured by group *"(\w)"*
*"{2,}"* = repeat 2 or more times (i.e. 3 or more in total)
*"\B" *= NOT a word-boundary. 

Matches ...
The Dark Wod
Index9996no

No matches ...
The band played "Om-pa-pa"
The Item 999 is in stock
The Item999 is in stock

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8c45ec4f-7727-4c27-ab96-9e46b04182b6%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-02 Thread @TiddlyTweeter
Very interesting!

I think about it a bit!

HansWobbe wrote:
>
> If you like regExp and ways of exploiting it, you might enjoy these...
> Chinese Ideographic Telegraph Symbol for Day One ...
>
> https://unicode-table.com/en/33E0/
>
> ㏠ ㏡ ㏢ ㏣ ㏤ ㏥ ㏦ ㏧ ㏨ ㏩ ㏪ ㏫ ㏬ ㏭ ㏮ ㏯ ㏰ ㏱ ㏲ ㏳ ㏴ ㏵ ㏶ ㏷ ㏸ ㏹ ㏺ ㏻ ㏼ ㏽ ㏾ 
>
> I often combine them with the equivalent Month symbols to create a dense 
> date encoding that is useful as Tags and Search targets
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/7819178e-ba73-4918-83af-3962b7e19627%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-02 Thread HansWobbe
If you like regExp and ways of exploiting it, you might enjoy these...
Chinese Ideographic Telegraph Symbol for Day One ...

https://unicode-table.com/en/33E0/

㏠ ㏡ ㏢ ㏣ ㏤ ㏥ ㏦ ㏧ ㏨ ㏩ ㏪ ㏫ ㏬ ㏭ ㏮ ㏯ ㏰ ㏱ ㏲ ㏳ ㏴ ㏵ ㏶ ㏷ ㏸ ㏹ ㏺ ㏻ ㏼ ㏽ ㏾ 

I often combine them with the equivalent Month symbols to create a dense 
date encoding that is useful as Tags and Search targets.

Cheers,
Hans


On Monday, September 2, 2019 at 1:50:58 PM UTC-4, @TiddlyTweeter wrote:
>
> Hi Hans
>
> ...
>
 

> Do ask me if you ever have a language issue on matching. I like playing 
> regex.
>
> TT 
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/53f0b784-2267-4ffd-bbf6-64cc90e6113b%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-02 Thread @TiddlyTweeter
Hi Hans

I find regular expressions are very economical for working in languages 
that need more than the English a-z. 

It just needs a bit of work to setup the character classes.

Do ask me if you ever have a language issue on matching. I like playing 
regex.

TT 

On Monday, 2 September 2019 19:30:49 UTC+2, HansWobbe wrote:
>
>
> @TiddlyTweeter: Neat!
>
> It simply had not occurred to me to use this simple method, in spite of 
> the fact that I make extensive use of the characters as leading or trailing 
> sigils in my titles, from Unicode ranges like 
> https://unicode-table.com/en/blocks/mathematical-alphanumeric-symbols/.  
>
> After all, if mathematicians can agree to reserve ranges of characters for 
> the formulas used in their specific fields of study, perhaps we could; 
> especially given the powerful tagging capabilities of TW.
>
> Cheers,
> Hans
>
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8b9ba740-2fe5-4d05-b3c6-fa176872b765%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-02 Thread HansWobbe

@TiddlyTweeter: Neat!

It simply had not occurred to me to use this simple method, in spite of the 
fact that I make extensive use of the characters as leading or trailing 
sigils in my titles, from Unicode ranges like 
https://unicode-table.com/en/blocks/mathematical-alphanumeric-symbols/.  

After all, if mathematicians can agree to reserve ranges of characters for 
the formulas used in their specific fields of study, perhaps we could; 
especially given the poworful tagging capabilities of TW.

Cheers,
Hans


-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/c7509d10-c4b7-45b3-ac69-08c94ac8f5bf%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-09-02 Thread @TiddlyTweeter
Footnote. This could be simplified further to just ...

Match any single German accented character ...
*[ßÄÖÜẞäöü]*

Note, because it uses "[...]" character class, which are "reserved 
characters" in TW, the regular expression needs to be placed in a variable 
and the variable called by the TW regexp. For example ...

<$set name="german-accented" value="[ßÄÖÜẞäöü]">
<]">>


TT

On Friday, 30 August 2019 10:30:43 UTC+2, @TiddlyTweeter wrote:
>
> *Find titles with at least one German accented character ...*
> ^.*?[ßÄÖÜẞäöü]+?
>
> Field: Title
>
> *"^"* = start of "scope" (in this case the start of the Title field)
>
> *".*?" *= match any character except line-breaks, but as few times as 
> possible ("lazy" matching). 
> Note: If you used *".*" *it would match the accented characters before we 
> actually specifically matched them. *So it must be lazy*.
>
> *[ßÄÖÜẞäöü]+?* = Match at least one German accented character.
> Note: Once we match the first German accented character its not needed to 
> continue to the end of the field.
>
> *Matches these Titles, ->match<-* ...
>
> ->"Ü<-ber" is a German word. ↩︎
> ->The word "Ü<-ber" is used in German.↩︎
>
>
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ab949136-f429-4194-803f-4bc8804fe89a%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-08-30 Thread @TiddlyTweeter
*Find titles with at least one German accented character ...*
^.*?[ßÄÖÜẞäöü]+?

Field: Title

*"^"* = start of "scope" (in this case the start of the Title field)

*".*?" *= match any character except line-breaks, but as few times as 
possible ("lazy" matching). 
Note: If you used *".*" *it would match the accented characters before we 
actually specifically matched them. *So it must be lazy*.

*[ßÄÖÜẞäöü]+?* = Match at least one German accented character.
Note: Once we match the first German accented character its not needed to 
continue to the end of the field.

*Matches these Titles, ->match<-* ...

->"Ü<-ber" is a German word. ↩︎
->The word "Ü<-ber" is used in German.↩︎



-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/c8e4a095-6aa4-4e02-ad81-9afcb0113e9c%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-08-28 Thread @TiddlyTweeter
May I hesitate and point out that a TW date (singleton wiki) can ONLY be a 
number of finite length?

And that number HAS to be *something*. Mohammad & I tend to believe in 
those numbers.

When does GMT <> UTC  change that?

*I'm struggling without your point.* 

TT

On Wednesday, 28 August 2019 18:11:05 UTC+2, Mark S. wrote:
>
> What, have I stumbled into some political landmine? GMT <> UTC ?
>
> It can be the 3rd of the month (with an easy regexp) in one place, but the 
> 2nd of the month somewhere else. In that somewhere else, it would
> require a more complicated regexp that matches say 03(00|02|03) to the 2nd 
> of the month.
>
> But if you wanted to stick to only UTC, then I think Mohammad's #2 request 
> should be possible, though painful. There's only 14 possible yearly 
> calendars. So you could
> match the year against a "wednesday" calendar. Then match the month and 
> day to determine if the date was a wednesday. There's about 4 Wednesdays per
> month, so there's about 672 elements that would have to be programmed (not 
> counting the years, which would be limited to however many you wanted
> to plug in. Whew. That's why date filter operators are needed.
>
> On Wednesday, August 28, 2019 at 7:42:16 AM UTC-7, @TiddlyTweeter wrote:
>>
>> What's Greenwich got to do with it?
>>
>> On Wednesday, 28 August 2019 16:32:24 UTC+2, Mark S. wrote:
>>>
>>> The 3rd of the month AT Greenwich, or somewhere else?
>>>
>>> You would need to make a different match for every target locale. One 
>>> location's 3rd is another location's 2nd and another location's 4th.
>>>
>>> I don't think regex is a good match for this kind of date comparison. 
>>> What we need are more tools that will allow us to access and compare
>>> date stamps. More ways to convert local dates into UTC, add/subtract 
>>> days, and then convert them back. Filters that understand days of
>>> the week, month, year. That sort of thing.
>>>
>>> Thanks!
>>>
>>> On Tuesday, August 27, 2019 at 10:48:13 PM UTC-7, Mohammad wrote:

 Some solution to first group

 modified in 2019: ^2019
 modified in January 2019: ^201901
 modified in August (any year) : ^\d{4}09
 modified on 3rd of each month: ^\d{6}03
 modified on 1st of December (any year): ^\d{4}1201
 modified between 1st and 9th of December (any year): ^\d{4}120


 The question

 created/modified on Wednesdays

 seems tricky and needs some scripting

 Cheers
 Mohammad



-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/49dcd2f1-60ec-424f-bc83-61c785966ae5%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-08-28 Thread 'Mark S.' via TiddlyWiki
What, have I stumbled into some political landmine? GMT <> UTC ?

It can be the 3rd of the month (with an easy regexp) in one place, but the 
2nd of the month somewhere else. In that somewhere else, it would
require a more complicated regexp that matches say 03(00|02|03) to the 2nd 
of the month.

But if you wanted to stick to only UTC, then I think Mohammad's #2 request 
should be possible, though painful. There's only 14 possible yearly 
calendars. So you could
match the year against a "wednesday" calendar. Then match the month and day 
to determine if the date was a wednesday. There's about 4 Wednesdays per
month, so there's about 672 elements that would have to be programmed (not 
counting the years, which would be limited to however many you wanted
to plug in. Whew. That's why date filter operators are needed.

On Wednesday, August 28, 2019 at 7:42:16 AM UTC-7, @TiddlyTweeter wrote:
>
> What's Greenwich got to do with it?
>
> On Wednesday, 28 August 2019 16:32:24 UTC+2, Mark S. wrote:
>>
>> The 3rd of the month AT Greenwich, or somewhere else?
>>
>> You would need to make a different match for every target locale. One 
>> location's 3rd is another location's 2nd and another location's 4th.
>>
>> I don't think regex is a good match for this kind of date comparison. 
>> What we need are more tools that will allow us to access and compare
>> date stamps. More ways to convert local dates into UTC, add/subtract 
>> days, and then convert them back. Filters that understand days of
>> the week, month, year. That sort of thing.
>>
>> Thanks!
>>
>> On Tuesday, August 27, 2019 at 10:48:13 PM UTC-7, Mohammad wrote:
>>>
>>> Some solution to first group
>>>
>>> modified in 2019: ^2019
>>> modified in January 2019: ^201901
>>> modified in August (any year) : ^\d{4}09
>>> modified on 3rd of each month: ^\d{6}03
>>> modified on 1st of December (any year): ^\d{4}1201
>>> modified between 1st and 9th of December (any year): ^\d{4}120
>>>
>>>
>>> The question
>>>
>>> created/modified on Wednesdays
>>>
>>> seems tricky and needs some scripting
>>>
>>> Cheers
>>> Mohammad
>>>
>>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/fb3f95d5-ed2b-4163-8d84-d687aba88935%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-08-28 Thread @TiddlyTweeter
What's Greenwich got to do with it?

On Wednesday, 28 August 2019 16:32:24 UTC+2, Mark S. wrote:
>
> The 3rd of the month AT Greenwich, or somewhere else?
>
> You would need to make a different match for every target locale. One 
> location's 3rd is another location's 2nd and another location's 4th.
>
> I don't think regex is a good match for this kind of date comparison. What 
> we need are more tools that will allow us to access and compare
> date stamps. More ways to convert local dates into UTC, add/subtract days, 
> and then convert them back. Filters that understand days of
> the week, month, year. That sort of thing.
>
> Thanks!
>
> On Tuesday, August 27, 2019 at 10:48:13 PM UTC-7, Mohammad wrote:
>>
>> Some solution to first group
>>
>> modified in 2019: ^2019
>> modified in January 2019: ^201901
>> modified in August (any year) : ^\d{4}09
>> modified on 3rd of each month: ^\d{6}03
>> modified on 1st of December (any year): ^\d{4}1201
>> modified between 1st and 9th of December (any year): ^\d{4}120
>>
>>
>> The question
>>
>> created/modified on Wednesdays
>>
>> seems tricky and needs some scripting
>>
>> Cheers
>> Mohammad
>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/fcced779-a871-40bb-baea-0a3cdd119da8%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-08-28 Thread @TiddlyTweeter
It is.

On Wednesday, 28 August 2019 16:39:00 UTC+2, Mohammad wrote:
>
> Hi Mark,
>  By third I mean what is stotred in modified field so if it is 
> mm03??..   I interpret it as 3rd of month!
>
> --Mohammad
>
> On Wednesday, August 28, 2019 at 7:02:24 PM UTC+4:30, Mark S. wrote:
>>
>> The 3rd of the month AT Greenwich, or somewhere else?
>>
>> You would need to make a different match for every target locale. One 
>> location's 3rd is another location's 2nd and another location's 4th.
>>
>> I don't think regex is a good match for this kind of date comparison. 
>> What we need are more tools that will allow us to access and compare
>> date stamps. More ways to convert local dates into UTC, add/subtract 
>> days, and then convert them back. Filters that understand days of
>> the week, month, year. That sort of thing.
>>
>> Thanks!
>>
>> On Tuesday, August 27, 2019 at 10:48:13 PM UTC-7, Mohammad wrote:
>>>
>>> Some solution to first group
>>>
>>> modified in 2019: ^2019
>>> modified in January 2019: ^201901
>>> modified in August (any year) : ^\d{4}09
>>> modified on 3rd of each month: ^\d{6}03
>>> modified on 1st of December (any year): ^\d{4}1201
>>> modified between 1st and 9th of December (any year): ^\d{4}120
>>>
>>>
>>> The question
>>>
>>> created/modified on Wednesdays
>>>
>>> seems tricky and needs some scripting
>>>
>>> Cheers
>>> Mohammad
>>>
>>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/af7b4e50-4e46-4403-b102-abe8f8af0289%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-08-28 Thread Mohammad
Hi Mark,
 By third I mean what is stotred in modified field so if it is 
mm03??..   I interpret it as 3rd of month!

--Mohammad

On Wednesday, August 28, 2019 at 7:02:24 PM UTC+4:30, Mark S. wrote:
>
> The 3rd of the month AT Greenwich, or somewhere else?
>
> You would need to make a different match for every target locale. One 
> location's 3rd is another location's 2nd and another location's 4th.
>
> I don't think regex is a good match for this kind of date comparison. What 
> we need are more tools that will allow us to access and compare
> date stamps. More ways to convert local dates into UTC, add/subtract days, 
> and then convert them back. Filters that understand days of
> the week, month, year. That sort of thing.
>
> Thanks!
>
> On Tuesday, August 27, 2019 at 10:48:13 PM UTC-7, Mohammad wrote:
>>
>> Some solution to first group
>>
>> modified in 2019: ^2019
>> modified in January 2019: ^201901
>> modified in August (any year) : ^\d{4}09
>> modified on 3rd of each month: ^\d{6}03
>> modified on 1st of December (any year): ^\d{4}1201
>> modified between 1st and 9th of December (any year): ^\d{4}120
>>
>>
>> The question
>>
>> created/modified on Wednesdays
>>
>> seems tricky and needs some scripting
>>
>> Cheers
>> Mohammad
>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/c4e4c6b3-9de4-4c86-a919-fba2d4d4275f%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-08-28 Thread 'Mark S.' via TiddlyWiki
The 3rd of the month AT Greenwich, or somewhere else?

You would need to make a different match for every target locale. One 
location's 3rd is another location's 2nd and another location's 4th.

I don't think regex is a good match for this kind of date comparison. What 
we need are more tools that will allow us to access and compare
date stamps. More ways to convert local dates into UTC, add/subtract days, 
and then convert them back. Filters that understand days of
the week, month, year. That sort of thing.

Thanks!

On Tuesday, August 27, 2019 at 10:48:13 PM UTC-7, Mohammad wrote:
>
> Some solution to first group
>
> modified in 2019: ^2019
> modified in January 2019: ^201901
> modified in August (any year) : ^\d{4}09
> modified on 3rd of each month: ^\d{6}03
> modified on 1st of December (any year): ^\d{4}1201
> modified between 1st and 9th of December (any year): ^\d{4}120
>
>
> The question
>
> created/modified on Wednesdays
>
> seems tricky and needs some scripting
>
> Cheers
> Mohammad
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0aa32494-e604-4d01-a667-f0d7e244825c%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-08-28 Thread Mohammad

>
> Q: Anyone want to try 4-9pm on all days from the 1st of August to the 
> 25th? :-)
>
> TT
>

Is this a quiz for Mark?

:-) 

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/3bfe9fa1-72a8-499e-bd58-cd702f3b2f3d%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-08-28 Thread Mohammad
Hi TT,
 By modified, I mean the date value stored in the modified field of tiddler 
which is created automatically by TW.
Thanks for provided alternative solutions and extra examples.

Cheers
Mohammad


On Wednesday, August 28, 2019 at 10:28:05 AM UTC+4:30, @TiddlyTweeter wrote:
>
> *Target fields*: created modified
>>
>> write regexp patterns to match
>>
>>1. created/modified  in August 2019
>>2. created/modified on Wednesdays
>>3. created/modified on 3rd day of each month
>>4. created/modified on 1st of December of each year
>>5. created/modified on January of each year
>>
>> You mean, match against the number in "modified"?
>
> *No 2* I can't see a way in regex to do that from date numbers. 
>
> Modified / Created fields contain a number, meaning
> MMDDhhmmssmil
> 20190827150116448
>
>
> *August 2019*
> ^201908
> *"^"* = match from start of field
>
> *3rd day of any month, any year*
> ^..03
> *"."* = match any in-line character
>
> *1st of December of any year*
> ^1201 
>   or 
> ^\d{4}1201
> *"\d"* = shorthand for *[0-9]*
> *"{4}"* = repeat preceding pattern exactly 4 times
>
> *January of any year*
> ^01 
>   or
> ^\d{4}01
>
> *The 2nd & 7th of March & April 2017*
> ^20170[34]0[27] 
>   or
> ^20170(3|4)0(2|7) 
> *"[..]" *= Character Class
> *"(..)" *= Capturing Group;* "|" *= alternation 
>
> ---
>
> Q: Anyone want to try 4-9pm on all days from the 1st of August to the 
> 25th? :-)
>
> TT
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/506f6f7c-3d13-48ab-882b-d0e9981535fb%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-08-27 Thread @TiddlyTweeter

>
> *Target fields*: created modified
>
> write regexp patterns to match
>
>1. created/modified  in August 2019
>2. created/modified on Wednesdays
>3. created/modified on 3rd day of each month
>4. created/modified on 1st of December of each year
>5. created/modified on January of each year
>
> You mean, match against the number in "modified"?

*No 2* I can't see a way in regex to do that from date numbers. 

Modified / Created fields contain a number, meaning
MMDDhhmmssmil
20190827150116448


*August 2019*
^201908
*"^"* = match from start of field

*3rd day of any month, any year*
^..03
*"."* = match any in-line character

*1st of December of any year*
^1201 
  or 
^\d{4}1201
*"\d"* = shorthand for *[0-9]*
*"{4}"* = repeat preceding pattern exactly 4 times

*January of any year*
^01 
  or
^\d{4}01

*The 2nd & 7th of March & April 2017*
^20170[34]0[27] 
  or
^20170(3|4)0(2|7) 
*"[..]" *= Character Class
*"(..)" *= Capturing Group;* "|" *= alternation 

---

Q: Anyone want to try 4-9pm on all days from the 1st of August to the 25th? 
:-)

TT

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6e55a4c4-816f-4032-84a1-8db8c45afc59%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-08-27 Thread Mohammad
Some solution to first group

modified in 2019: ^2019
modified in January 2019: ^201901
modified in August (any year) : ^\d{4}09
modified on 3rd of each month: ^\d{6}03
modified on 1st of December (any year): ^\d{4}1201
modified between 1st and 9th of December (any year): ^\d{4}120


The question

created/modified on Wednesdays

seems tricky and needs some scripting

Cheers
Mohammad

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/097e980a-08fe-44e1-8af4-85ccbe2a0656%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-08-27 Thread Mohammad
Some solutions!

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4a3061af-9a10-49df-a18d-edf9ad43beed%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples part ii: Working with fields

2019-08-27 Thread @TiddlyTweeter
Mohammad

An issue is how to use foreign languages. Regex character ranges like \w don't 
have accented letters. But there ways to deal with that.

TT

On Tuesday, 27 August 2019 13:01:07 UTC+2, Mohammad wrote:
>
> In this part questions raise for finding and matching a substring in a 
> Tiddler fields. This field is NOT text
> as we will discuss this in another thread and seems needs more work.
>
> *Target fields*: created modified
>
> write regexp patterns to match
>
>
>1. created/modified  in August 2019
>2. created/modified on Wednesdays
>3. created/modified on 3rd day of each month
>4. created/modified on 1st of December of each year
>5. created/modified on January of each year
>
>
>
> Target fields: other user fields
>
>1. store a url in format http://xx.yy... or https://xx.yy...
>2. store an email: like jeremy...@tiddlywiki.com  or 
>jer...@tw5.org 
>3. store an integer number only: like 598012543
>4. store a negative  integer number only: like 598012543
>5. store an image filename like .png/.jpeg/.tiff/.gif
>6. store a transcluded value in the form of {{aaa}}
>7. store a transcluded value in the form of {{aaa!!bb}}
>8. store an html tag like content 
>9. store image like [img[source]] or [img width=xx [source]]
>10. store a floating number 1.2365
>11. store time in format hh:mm:ss or hh:mm:ss am/pm
>
>
> Please give solution! Please give other use cases
> Only focus on user fields and system fields except TEXT and Tags and Title.
>
> Cheers
> Mohammad
>
> Mohammad
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/081b2299-ffd1-43f7-a2ce-f43cdfcb6ee2%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-27 Thread @TiddlyTweeter
TonyM wrote:
>
> Now to test a fixed number such as 127 I imagine that's just a string?
>

Yes. The examples I just gave will help.

TT
 

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f658aad5-0f92-476f-bb69-8737995338df%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-27 Thread @TiddlyTweeter

>
> TonyM wrote:
> ...  check for 10.*.*.* 192.168.*.* 127.*.*.* or if equal to 1.1.1.1 or 
> 0.0.0.0. to determine if they are local or public addresses. 


Using the 0-255 regex of last post you can build a more complex regex.

Because I never worked with IP addresses I consulted Wikipedia to 
understand ranges  IPv4, private network addresses 
.

*IPv4, private network: 192.168.0.0 – 192.168.255.255*

*(\b192\.168(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b){2})*

I'll explain this one. The others should then be readable.

*( *= open capture group 1
*\b *= word boundary
198 literal
*\. *= escape for literal stop-mark (otherwise *"."* matches  any character)
168 literal
*( *= open capture group 2
*\. *= literal stop-mark
*( *= open capture group 3
*[0-9] etc.* = regex we made in last post to match 0-255
*) *= close capture group 3
*\b *= word boundary
*) *= close capture group 2
*{2}* = repeat pattern in group 2 twice
*) *= close capture group 1

*IPv4, private network: 10.0.0.0 – 10.255.255.255*
*(\b10(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b){3})*

Much like previous, notice *{3}.*

*IPv4, private network: 172.16.0.0 – 172.31.255.255*

*(\b172\.(1[6-9]|2[0-9]|3[01])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b){2})*

This is a bit more complex as it needs 2 ranges. *16-31* and *0-255*. N
otice *{3}.*

*IPv4 private networks starting: 10, 192.168, 172.16*

*(\b(192\.168|10|172\.(1[6-9]|2[0-9]|3[01]))(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b){2,3})*

This combines the three above into one regex. More advanced, but gives idea 
you can combine things. Notice* {2,3}.*

Test for this more complex one
*-> ... is match*

_Should NOT match_↩︎
9.255.255.255↩︎
10.0.0.00↩︎
147.168.255.255↩︎
172.32.255.255↩︎
172.14.255.255↩︎
192.168.1.256↩︎
192.27.255.255↩︎
↩︎
_Should match_↩︎
->10.0.0.0↩︎
->172.16.89.125↩︎
->192.168.1.1↩︎
->192.168.1.255↩︎


TT

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/5e274db2-e816-4f1c-ba85-bed4c5ccd6b5%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-27 Thread TonyM
Thanks TT

Now to test a fixed number such as 127 I imagine that's just a string?

tony

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/9a2cef52-6453-4742-84cd-ece7c383a75c%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-27 Thread @TiddlyTweeter
TonyM wrote:
>
> ...  check for 10.*.*.* 192.168.*.* 127.*.*.* or if equal to 1.1.1.1 or 
> 0.0.0.0. to determine if they are local or public addresses. 
>

I done this in two posts so its easier to understand. 

To help Mohammad document let's first deal with how to simply match IP 
sub-numbers 0 to 255 using regex in decimal & binary.

*0-255, Decimal*

0-255 
Decimal, no leading zeros

*\b* = "word boundary". (In regex, numbers are just word characters.)
*"(...)"* = a capturing group.
*"|"* = alternate matches within the group (like "or")
*[0-9]* = match from 0 to 9
*[1-9][0-9]* = 10 to 99
*1[0-9][0-9]* = 100 to 199
*2[0-4][0-9]* = 200 to 249
*25[0-5]* = 250 to 255
*\b *= "word boundary"


*-, Binary*

IP addresses, in binary, use leading zeros. These are very easy to match. 

255 decimal is  binary, so just repeat 1 or 0 8 times by using {8} next 
to the class or group.

Using* [...] *Character Class 
-, Binary Byte

Using* "|" *Alternation in a Capture Group 
-, Binary Byte

*Interesting fact: This is the maximum info a byte (8 bits) can hold, in 
decimal 255 & 0, i.e. 256 combinations, hence "magic number" 256.*

TT

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6e312779-b824-44d0-93f8-8784d33f56af%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-26 Thread Mohammad
Thanks for confirmation!

--Mohammad

On Monday, August 26, 2019 at 7:50:57 PM UTC+4:30, Mark S. wrote:
>
> Yep. Those are improvements.
>
> On Monday, August 26, 2019 at 8:12:54 AM UTC-7, Mohammad wrote:
>>
>> Please see this suggestion:
>>
>>
>>- tiddler starts with capital letter: ^[A-Z]   instead of ^[A-Z].*$
>>- tiddler starts with digits: ^[0-9] instead of ^[0-9].*$
>>
>>
>> What do you think?
>>
>> --Mohammad
>>
>> On Sunday, August 25, 2019 at 11:36:08 PM UTC+4:30, Mark S. wrote:
>>>
>>> Most of your examples have an implied scope of the entire tiddler title.
>>>
>>> That is, if the tiddler can only have lower case letters, then *every 
>>> single character* from start to end (^ to $) has to be lowercase.
>>>
>>> But duplicate words can start and end anywhere inside the title, so the 
>>> scope doesn't have to apply to every single character.
>>>
>>> So, it was my fault for churning them out *en masse*, using previous 
>>> versions as my template ;-) 
>>>
>>> Thanks!
>>>
>>> On Sunday, August 25, 2019 at 11:44:56 AM UTC-7, Mohammad wrote:

 Thanks Mark and Josiah,
  It seems the problem is with *^$*.

 I removed them and it works. But not sure where they  are required.

 @Josiah,
  I add the consecutive duplicate words!

 Thank you again

 --Mohammad

 On Sunday, August 25, 2019 at 10:34:13 PM UTC+4:30, @TiddlyTweeter 
 wrote:
>
> Mohammad 
>
> I'm not sure how much spaced repetition is an issue really ("I had an 
> old an clock")? The commonest issue is simple sequential repeating ("I 
> had 
> an an ...").
>
> But Mark's regex works on test data. Though I'd simplify it to ...
>
> (\b\w{2,}\b)(.*)\1
>
> Example match in test data (match in lines)...
>
> *-> ... <- is match*
>
> (\b\w{2,}\b)(.*)\1 ... spaced duplicate words to remove↩︎
> ↩︎
> This is a Tiddler ->This<- is Nice↩︎
> Nice Tiddler is This ->Tiddler<-↩︎
> Remove this repeat of ->this<- Tiddler repeat of ->repeat<-.↩︎
>
>
> TT
>
> On Sunday, 25 August 2019 17:29:10 UTC+2, Mohammad wrote:
>>
>> The duplicate words does not work!
>>
>> It seems only if the first word of title repeated it will be matched. 
>> Look at the below two tiddler titles
>>
>>
>>1. This is a Tiddler This is Nice
>>2. Nice Tiddler is This Tiddler
>>
>> The pattern will match the first but ignore the second while both 
>> have a duplicate word!
>>
>> --Mohammad
>>
>> On Friday, August 23, 2019 at 10:51:06 PM UTC+4:30, Mark S. wrote:
>>>
>>> Ok, with duplicates and date formats. Note that the date formats 
>>> only check for the format. You could still create
>>> nonsensical dates that actually match the formats (Jan 55 , 
>>> .15.55). Actual validation of dates would take
>>> real code massaging.
>>>
>>> <$vars digonly="^[0-9]*$">
>>> <$vars useme=<>>
>>> 
>>> 
>>>
>>> <$select tiddler="myregexp">
>>> Only digits
>>> Only lower case
>>> Only upper case
>>> Only alphanumeric, _, and -
>>> Only alphanum len 3-15
>>> Starts with capital
>>> Starts with digit
>>> Extensions only
>>> Extension jpg gpeg
>>> Duplicate words
>>> Duplicate words
>>> >> "^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s{1}\d{2}\s\d{4}$"
>>> >Date like Jan 06 2019
>>> Date like 2019.08.25
>>> 
>>> 
>>>
>>> <$list filter="[regexp{myregexp}sort[]]">
>>>
>>> 
>>>
>>>
>>>
>>> On Friday, August 23, 2019 at 12:11:07 AM UTC-7, Mohammad wrote:

 I am looking for examples and use cases of regexp in Tiddlywiki!
 Those can be done current filter operators like prefix, search,... 
 are not recommend to be done with regexp.

 I appreciate your help, case and examples on this. Just give what 
 you want to do.

 Some case

 Give a regexp pattern in Tiddlywiki to match all tiddlers name are


1. only digits
2. only lowercase letters
3. only uppercase letters
4. only alphanumeric and underscore and hyphen
5. only alphanumeric with length between 3 and 15
6. start with a capital letter
7. start with a digit
8. have a extension like mytiddler.ext
9. have jpg or jpeg extension like *mytiddler.jpg* or 
*mytiddler.gpeg*
10. are a date in format like Jan 06 2019 
11. are a date in format like 2019.08.25 
12. have duplicate words
13. have a valid url
14. 


 [This list will grow by more examples]


 Please give your use case.

 -- Mohammad



-- 
You 

[tw5] Re: Tiddlywiki and regexp examples

2019-08-26 Thread 'Mark S.' via TiddlyWiki
Yep. Those are improvements.

On Monday, August 26, 2019 at 8:12:54 AM UTC-7, Mohammad wrote:
>
> Please see this suggestion:
>
>
>- tiddler starts with capital letter: ^[A-Z]   instead of ^[A-Z].*$
>- tiddler starts with digits: ^[0-9] instead of ^[0-9].*$
>
>
> What do you think?
>
> --Mohammad
>
> On Sunday, August 25, 2019 at 11:36:08 PM UTC+4:30, Mark S. wrote:
>>
>> Most of your examples have an implied scope of the entire tiddler title.
>>
>> That is, if the tiddler can only have lower case letters, then *every 
>> single character* from start to end (^ to $) has to be lowercase.
>>
>> But duplicate words can start and end anywhere inside the title, so the 
>> scope doesn't have to apply to every single character.
>>
>> So, it was my fault for churning them out *en masse*, using previous 
>> versions as my template ;-) 
>>
>> Thanks!
>>
>> On Sunday, August 25, 2019 at 11:44:56 AM UTC-7, Mohammad wrote:
>>>
>>> Thanks Mark and Josiah,
>>>  It seems the problem is with *^$*.
>>>
>>> I removed them and it works. But not sure where they  are required.
>>>
>>> @Josiah,
>>>  I add the consecutive duplicate words!
>>>
>>> Thank you again
>>>
>>> --Mohammad
>>>
>>> On Sunday, August 25, 2019 at 10:34:13 PM UTC+4:30, @TiddlyTweeter wrote:

 Mohammad 

 I'm not sure how much spaced repetition is an issue really ("I had an 
 old an clock")? The commonest issue is simple sequential repeating ("I had 
 an an ...").

 But Mark's regex works on test data. Though I'd simplify it to ...

 (\b\w{2,}\b)(.*)\1

 Example match in test data (match in lines)...

 *-> ... <- is match*

 (\b\w{2,}\b)(.*)\1 ... spaced duplicate words to remove↩︎
 ↩︎
 This is a Tiddler ->This<- is Nice↩︎
 Nice Tiddler is This ->Tiddler<-↩︎
 Remove this repeat of ->this<- Tiddler repeat of ->repeat<-.↩︎


 TT

 On Sunday, 25 August 2019 17:29:10 UTC+2, Mohammad wrote:
>
> The duplicate words does not work!
>
> It seems only if the first word of title repeated it will be matched. 
> Look at the below two tiddler titles
>
>
>1. This is a Tiddler This is Nice
>2. Nice Tiddler is This Tiddler
>
> The pattern will match the first but ignore the second while both have 
> a duplicate word!
>
> --Mohammad
>
> On Friday, August 23, 2019 at 10:51:06 PM UTC+4:30, Mark S. wrote:
>>
>> Ok, with duplicates and date formats. Note that the date formats only 
>> check for the format. You could still create
>> nonsensical dates that actually match the formats (Jan 55 , 
>> .15.55). Actual validation of dates would take
>> real code massaging.
>>
>> <$vars digonly="^[0-9]*$">
>> <$vars useme=<>>
>> 
>> 
>>
>> <$select tiddler="myregexp">
>> Only digits
>> Only lower case
>> Only upper case
>> Only alphanumeric, _, and -
>> Only alphanum len 3-15
>> Starts with capital
>> Starts with digit
>> Extensions only
>> Extension jpg gpeg
>> Duplicate words
>> Duplicate words
>> > "^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s{1}\d{2}\s\d{4}$"
>> >Date like Jan 06 2019
>> Date like 2019.08.25
>> 
>> 
>>
>> <$list filter="[regexp{myregexp}sort[]]">
>>
>> 
>>
>>
>>
>> On Friday, August 23, 2019 at 12:11:07 AM UTC-7, Mohammad wrote:
>>>
>>> I am looking for examples and use cases of regexp in Tiddlywiki!
>>> Those can be done current filter operators like prefix, search,... 
>>> are not recommend to be done with regexp.
>>>
>>> I appreciate your help, case and examples on this. Just give what 
>>> you want to do.
>>>
>>> Some case
>>>
>>> Give a regexp pattern in Tiddlywiki to match all tiddlers name are
>>>
>>>
>>>1. only digits
>>>2. only lowercase letters
>>>3. only uppercase letters
>>>4. only alphanumeric and underscore and hyphen
>>>5. only alphanumeric with length between 3 and 15
>>>6. start with a capital letter
>>>7. start with a digit
>>>8. have a extension like mytiddler.ext
>>>9. have jpg or jpeg extension like *mytiddler.jpg* or 
>>>*mytiddler.gpeg*
>>>10. are a date in format like Jan 06 2019 
>>>11. are a date in format like 2019.08.25 
>>>12. have duplicate words
>>>13. have a valid url
>>>14. 
>>>
>>>
>>> [This list will grow by more examples]
>>>
>>>
>>> Please give your use case.
>>>
>>> -- Mohammad
>>>
>>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

[tw5] Re: Tiddlywiki and regexp examples

2019-08-26 Thread Mohammad
Please see this suggestion:


   - tiddler starts with capital letter: ^[A-Z]   instead of ^[A-Z].*$
   - tiddler starts with digits: ^[0-9] instead of ^[0-9].*$


What do you think?

--Mohammad

On Sunday, August 25, 2019 at 11:36:08 PM UTC+4:30, Mark S. wrote:
>
> Most of your examples have an implied scope of the entire tiddler title.
>
> That is, if the tiddler can only have lower case letters, then *every 
> single character* from start to end (^ to $) has to be lowercase.
>
> But duplicate words can start and end anywhere inside the title, so the 
> scope doesn't have to apply to every single character.
>
> So, it was my fault for churning them out *en masse*, using previous 
> versions as my template ;-) 
>
> Thanks!
>
> On Sunday, August 25, 2019 at 11:44:56 AM UTC-7, Mohammad wrote:
>>
>> Thanks Mark and Josiah,
>>  It seems the problem is with *^$*.
>>
>> I removed them and it works. But not sure where they  are required.
>>
>> @Josiah,
>>  I add the consecutive duplicate words!
>>
>> Thank you again
>>
>> --Mohammad
>>
>> On Sunday, August 25, 2019 at 10:34:13 PM UTC+4:30, @TiddlyTweeter wrote:
>>>
>>> Mohammad 
>>>
>>> I'm not sure how much spaced repetition is an issue really ("I had an 
>>> old an clock")? The commonest issue is simple sequential repeating ("I had 
>>> an an ...").
>>>
>>> But Mark's regex works on test data. Though I'd simplify it to ...
>>>
>>> (\b\w{2,}\b)(.*)\1
>>>
>>> Example match in test data (match in lines)...
>>>
>>> *-> ... <- is match*
>>>
>>> (\b\w{2,}\b)(.*)\1 ... spaced duplicate words to remove↩︎
>>> ↩︎
>>> This is a Tiddler ->This<- is Nice↩︎
>>> Nice Tiddler is This ->Tiddler<-↩︎
>>> Remove this repeat of ->this<- Tiddler repeat of ->repeat<-.↩︎
>>>
>>>
>>> TT
>>>
>>> On Sunday, 25 August 2019 17:29:10 UTC+2, Mohammad wrote:

 The duplicate words does not work!

 It seems only if the first word of title repeated it will be matched. 
 Look at the below two tiddler titles


1. This is a Tiddler This is Nice
2. Nice Tiddler is This Tiddler

 The pattern will match the first but ignore the second while both have 
 a duplicate word!

 --Mohammad

 On Friday, August 23, 2019 at 10:51:06 PM UTC+4:30, Mark S. wrote:
>
> Ok, with duplicates and date formats. Note that the date formats only 
> check for the format. You could still create
> nonsensical dates that actually match the formats (Jan 55 , 
> .15.55). Actual validation of dates would take
> real code massaging.
>
> <$vars digonly="^[0-9]*$">
> <$vars useme=<>>
> 
> 
>
> <$select tiddler="myregexp">
> Only digits
> Only lower case
> Only upper case
> Only alphanumeric, _, and -
> Only alphanum len 3-15
> Starts with capital
> Starts with digit
> Extensions only
> Extension jpg gpeg
> Duplicate words
> Duplicate words
>  "^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s{1}\d{2}\s\d{4}$"
> >Date like Jan 06 2019
> Date like 2019.08.25
> 
> 
>
> <$list filter="[regexp{myregexp}sort[]]">
>
> 
>
>
>
> On Friday, August 23, 2019 at 12:11:07 AM UTC-7, Mohammad wrote:
>>
>> I am looking for examples and use cases of regexp in Tiddlywiki!
>> Those can be done current filter operators like prefix, search,... 
>> are not recommend to be done with regexp.
>>
>> I appreciate your help, case and examples on this. Just give what you 
>> want to do.
>>
>> Some case
>>
>> Give a regexp pattern in Tiddlywiki to match all tiddlers name are
>>
>>
>>1. only digits
>>2. only lowercase letters
>>3. only uppercase letters
>>4. only alphanumeric and underscore and hyphen
>>5. only alphanumeric with length between 3 and 15
>>6. start with a capital letter
>>7. start with a digit
>>8. have a extension like mytiddler.ext
>>9. have jpg or jpeg extension like *mytiddler.jpg* or 
>>*mytiddler.gpeg*
>>10. are a date in format like Jan 06 2019 
>>11. are a date in format like 2019.08.25 
>>12. have duplicate words
>>13. have a valid url
>>14. 
>>
>>
>> [This list will grow by more examples]
>>
>>
>> Please give your use case.
>>
>> -- Mohammad
>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/eb2f4d4a-90ff-4576-9a54-ae994cf6ddcf%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-26 Thread @TiddlyTweeter

>
> M: May this include your previous tutorial.


Feel free to use anything I wrote.

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b00eef18-4e36-4c4f-be26-75cfb95cc3f8%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-26 Thread @TiddlyTweeter
The text field is no more difficult. Other than its longer.

The problem is explaining the flags.

TT

On Monday, 26 August 2019 14:41:50 UTC+2, Mohammad wrote:
>
> Hi TT,
>  I think the simplest is the title and then tag and other fields and most 
> difficult is the text!
>
> --Mohammad
>
> On Monday, August 26, 2019 at 3:12:17 PM UTC+4:30, @TiddlyTweeter wrote:
>>
>> Mohammad,
>>
>> http://tw-regexp.tiddlyspot.com/ is very good!!
>>
>> I doubt I have to make my own version now :-). In a way its better there 
>> is ONE resource, not two.
>>
>
> May this include your previous tutorial.
>  
>
>>
>> One thing *we need to document* is matching in the "text" field. 
>>
>> I think some of the our regex will FAIL because it is NOT clear what the 
>> default FLAGS for the "text" field are.
>>
>> Its obvious from the discussion most users have no idea what regex flags 
>> are, or that they matter to what happens.
>>
>> My impression is that *"."  *in the text field is NOT matching newlines 
>> (using the operator), which means many regex will break if they need to 
>> span them.
>>
>> TT
>>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4f00ba48-e0d3-4e62-a11d-e24dc763f6e4%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-26 Thread Mohammad
Hi TT,
 I think the simplest is the title and then tag and other fields and most 
difficult is the text!

--Mohammad

On Monday, August 26, 2019 at 3:12:17 PM UTC+4:30, @TiddlyTweeter wrote:
>
> Mohammad,
>
> http://tw-regexp.tiddlyspot.com/ is very good!!
>
> I doubt I have to make my own version now :-). In a way its better there 
> is ONE resource, not two.
>

May this include your previous tutorial.
 

>
> One thing *we need to document* is matching in the "text" field. 
>
> I think some of the our regex will FAIL because it is NOT clear what the 
> default FLAGS for the "text" field are.
>
> Its obvious from the discussion most users have no idea what regex flags 
> are, or that they matter to what happens.
>
> My impression is that *"."  *in the text field is NOT matching newlines 
> (using the operator), which means many regex will break if they need to 
> span them.
>
> TT
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/29956e89-205c-49cb-ba22-44b87ba748ca%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-26 Thread @TiddlyTweeter


On Monday, 26 August 2019 12:42:17 UTC+2, @TiddlyTweeter wrote:
>
> Mohammad,
>
> http://tw-regexp.tiddlyspot.com/ is very good!!
>
> I doubt I have to make my own version now :-). In a way its better there 
> is ONE resource, not two.
>
> One thing *we need to document* is matching in the "text" field. 
>
> I think some of the our regex will FAIL because it is NOT clear what the 
> default FLAGS for the "text" field are.
>
> Its obvious from the discussion most users have no idea what regex flags 
> are, or that they matter to what happens.
>
> My impression is that *"."  *in the text field is NOT matching newlines 
> (using the operator), which means many regex will break if they need to 
> span them.
>
> TT
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/73b19370-5868-4ef5-baa8-f25fa0dcd97f%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-26 Thread @TiddlyTweeter
Mohammad,

http://tw-regexp.tiddlyspot.com/ is very good!!

I doubt I have to make my own version now :-). In a way its better there is 
ONE resource, not two.

One thing *we need to document* is matching in the "text" field. 

I think some of the our regex will FAIL because it is NOT clear what the 
default FLAGS for the "text" field are.

Its obvious from the discussion most users have no idea what regex flags 
are, or that they matter to what happens.

My impression is that *"."  *in the text field is NOT matching newlines, 
which means many regex will break if they need to span them.

TT

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8ea45a48-ed30-417a-9612-628b8b599f0c%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-26 Thread Mohammad
Thanks Tony!
 This way I can use directly the title and the description filed can be 
avoided.

Cheers
Mohammad

On Monday, August 26, 2019 at 8:06:55 AM UTC+4:30, TonyM wrote:
>
> Mohammad,
>
> This is becoming a very helpful resource. thanks for sharing your work,
>
> I noticed the test for leading caps in a title - I discovered a method on 
> this to capitalise only when needed,
>
> for example try this in a tiddler named tiddlername
> <>
>
> or in 5.1.20 (First to lowercase is a good pattern see 
> https://tiddlywiki.com/#titlecase%20Operator)
> {{{ [{!!title}lowercase[]titlecase[]] }}}
>
> <$text text={{{ [{!!title}lowercase[]titlecase[]] }}}/>
>
> For example this can be used to capitalise a fieldname on display when you 
> can't store it capitalised
> {{{ [fields[]lowercase[]titlecase[]] }}}
>
> I suppose what I am saying here is capitalisation is more a display 
> feature than a necessary naming standard.
>
> Regards
> Tony
>
> On Monday, August 26, 2019 at 5:31:33 AM UTC+10, Mohammad wrote:
>>
>> See the latest update of documentation wiki in that most part of this 
>> thread has been documented
>>
>> rev: 0.5
>> url: http://tw-regexp.tiddlyspot.com/
>>
>> --Mohammad 
>>
>> On Sunday, August 25, 2019 at 11:34:11 PM UTC+4:30, @TiddlyTweeter wrote:
>>>
>>> Mark S. wrote:

 I think he means "02" literally. Usually IP numbers aren't padded, so 
 not sure.

 It's the range 0-255 that's problematic. Here's what I have for the 
 range:

 IP range 
 0-256

>>>
>>> IF that means numbers 000 to 255 it looks doable.
>>>
>>> Hmm, I guess with an IP you could add the mandatory delimiter (usually 
 ".") and repeat the group. But you would have to manually repeat the group 
 at the end where the delimiter must not be.

>>>
>>> That is quite easy in regex as you can make it just *"\.?"*. Repeat is 
>>> easy, just put the dot first on repeats.
>>>
>>> And then there's zero padding. Most of the IP numbers I've seen are not 
 zero-padded, but ...

>>>
>>> That is much more difficult in regex. So long as the system throws the 
>>> 0's away when not needed it may be okay?
>>>
>>> I think the first thing I would do is see what the internet says.

 A search for "regular expression ip address" immediately turns up a 
 page from O'Reilly, with both a simple
 version and an accurate version for checking IP. As I expected, they're 
 able to do a repeat on the structure 3 times, but
 have to do the last one by hand. They've figured out the 0 padding:

 ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$


 So ... no need to rebuild the wheel for most common use cases. Hmm, I 
 wonder about IPv6 ?

>>>
>>>
 Ok, sorry for the stream-of-consciousness problem-working.

>>>
>>> Its interesting & useful!
>>>
>>> TT
>>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/87e4099a-1f1d-4936-ad3e-1d4cf7a661cb%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-26 Thread @TiddlyTweeter
Mat could you please try this ...

Match between "@@" pairs

and let me know if it works.

TT

On Saturday, 24 August 2019 20:08:59 UTC+2, Mat wrote:
>
> @TiddlyTweeter wrote:
>>
>>
>> Match between "@@" pairs
>>
>> The *"+?"* is to make the match "lazy" so it won't extend beyond the 
>> second @@ to a third pair of @@.
>> The content between them is passed to a "capturing group".
>>
>
> Thank you - but: 
>
> If the match needs to span lines regex settings may need tweaking.
>>
>
> In deed, this common case is not found AFAICT:
>
> @@.mystyle
> foo bar
> @@
>
> <:-)
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/7ebd6989-1310-495a-9a8c-b3b352b180f5%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread TonyM
Mohammad,

This is becoming a very helpful resource. thanks for sharing your work,

I noticed the test for leading caps in a title - I discovered a method on 
this to capitalise only when needed,

for example try this in a tiddler named tiddlername
<>

or in 5.1.20 (First to lowercase is a good pattern 
see https://tiddlywiki.com/#titlecase%20Operator)
{{{ [{!!title}lowercase[]titlecase[]] }}}

<$text text={{{ [{!!title}lowercase[]titlecase[]] }}}/>

For example this can be used to capitalise a fieldname on display when you 
can't store it capitalised
{{{ [fields[]lowercase[]titlecase[]] }}}

I suppose what I am saying here is capitalisation is more a display feature 
than a necessary naming standard.

Regards
Tony

On Monday, August 26, 2019 at 5:31:33 AM UTC+10, Mohammad wrote:
>
> See the latest update of documentation wiki in that most part of this 
> thread has been documented
>
> rev: 0.5
> url: http://tw-regexp.tiddlyspot.com/
>
> --Mohammad 
>
> On Sunday, August 25, 2019 at 11:34:11 PM UTC+4:30, @TiddlyTweeter wrote:
>>
>> Mark S. wrote:
>>>
>>> I think he means "02" literally. Usually IP numbers aren't padded, so 
>>> not sure.
>>>
>>> It's the range 0-255 that's problematic. Here's what I have for the 
>>> range:
>>>
>>> IP range 
>>> 0-256
>>>
>>
>> IF that means numbers 000 to 255 it looks doable.
>>
>> Hmm, I guess with an IP you could add the mandatory delimiter (usually 
>>> ".") and repeat the group. But you would have to manually repeat the group 
>>> at the end where the delimiter must not be.
>>>
>>
>> That is quite easy in regex as you can make it just *"\.?"*. Repeat is 
>> easy, just put the dot first on repeats.
>>
>> And then there's zero padding. Most of the IP numbers I've seen are not 
>>> zero-padded, but ...
>>>
>>
>> That is much more difficult in regex. So long as the system throws the 
>> 0's away when not needed it may be okay?
>>
>> I think the first thing I would do is see what the internet says.
>>>
>>> A search for "regular expression ip address" immediately turns up a page 
>>> from O'Reilly, with both a simple
>>> version and an accurate version for checking IP. As I expected, they're 
>>> able to do a repeat on the structure 3 times, but
>>> have to do the last one by hand. They've figured out the 0 padding:
>>>
>>> ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
>>>
>>>
>>> So ... no need to rebuild the wheel for most common use cases. Hmm, I 
>>> wonder about IPv6 ?
>>>
>>
>>
>>> Ok, sorry for the stream-of-consciousness problem-working.
>>>
>>
>> Its interesting & useful!
>>
>> TT
>>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/1d57ec68-cedd-445c-8030-4603b961593b%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread TonyM
Folks,

Sorry for my absence for a while. The IP address idea the first character 
in each number should be [0-2] because only 0, 1 and 2 are valid in the 
hundreds position.

The idea would be to accept a value such as 124.3.0.1 and determine if it 
was valid ie no number between the dots should be other than a number from 
0-255

Ok we may not be able to avoid 299 being used but we could att a test that 
the whole number not be greater than 255

Separate tests could check for 10.*.*.* 192.168.*.* 127.*.*.* or if equal 
to 1.1.1.1 or 0.0.0.0. to determine if they are local or public addresses. 

Such a facility would allow tiddlywiki to become a DNS database and more as 
it relates to IP Addresses. Especially TiddlyDesktop that could launch 
pings and NSLookups, trace and more including opening the sites in an 
iframe.

I have always believed that Tiddlywiki would make a good platform for the 
following

   - Network and Operations database and dashboard
   - Configuration management database
   - Website and device directory
   - System Change management

Not to mention my quite old idea of building  device wiki that has all the 
details about a device including config settings, manuals, diagnostic 
methods and the device wiki can be stored in a repository and a copy on a 
usb stick secured to the device. A OTG USB cable adaptor would allow you to 
open the device wiki with a mobile device and where valid if the device has 
storage even host the wiki on the device and access it over the network eg; 
the usb port on your router.

So a macro and regex that makes IP Addresses trivial to handle will be a 
boon to these applications.

Regards
Tony


On Monday, August 26, 2019 at 5:31:33 AM UTC+10, Mohammad wrote:
>
> See the latest update of documentation wiki in that most part of this 
> thread has been documented
>
> rev: 0.5
> url: http://tw-regexp.tiddlyspot.com/
>
> --Mohammad 
>
> On Sunday, August 25, 2019 at 11:34:11 PM UTC+4:30, @TiddlyTweeter wrote:
>>
>> Mark S. wrote:
>>>
>>> I think he means "02" literally. Usually IP numbers aren't padded, so 
>>> not sure.
>>>
>>> It's the range 0-255 that's problematic. Here's what I have for the 
>>> range:
>>>
>>> IP range 
>>> 0-256
>>>
>>
>> IF that means numbers 000 to 255 it looks doable.
>>
>> Hmm, I guess with an IP you could add the mandatory delimiter (usually 
>>> ".") and repeat the group. But you would have to manually repeat the group 
>>> at the end where the delimiter must not be.
>>>
>>
>> That is quite easy in regex as you can make it just *"\.?"*. Repeat is 
>> easy, just put the dot first on repeats.
>>
>> And then there's zero padding. Most of the IP numbers I've seen are not 
>>> zero-padded, but ...
>>>
>>
>> That is much more difficult in regex. So long as the system throws the 
>> 0's away when not needed it may be okay?
>>
>> I think the first thing I would do is see what the internet says.
>>>
>>> A search for "regular expression ip address" immediately turns up a page 
>>> from O'Reilly, with both a simple
>>> version and an accurate version for checking IP. As I expected, they're 
>>> able to do a repeat on the structure 3 times, but
>>> have to do the last one by hand. They've figured out the 0 padding:
>>>
>>> ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
>>>
>>>
>>> So ... no need to rebuild the wheel for most common use cases. Hmm, I 
>>> wonder about IPv6 ?
>>>
>>
>>
>>> Ok, sorry for the stream-of-consciousness problem-working.
>>>
>>
>> Its interesting & useful!
>>
>> TT
>>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ec4e2b09-3a4f-44cc-a23f-8414cb041c3f%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread Mohammad
See the latest update of documentation wiki in that most part of this 
thread has been documented

rev: 0.5
url: http://tw-regexp.tiddlyspot.com/

--Mohammad 

On Sunday, August 25, 2019 at 11:34:11 PM UTC+4:30, @TiddlyTweeter wrote:
>
> Mark S. wrote:
>>
>> I think he means "02" literally. Usually IP numbers aren't padded, so not 
>> sure.
>>
>> It's the range 0-255 that's problematic. Here's what I have for the range:
>>
>> IP range 
>> 0-256
>>
>
> IF that means numbers 000 to 255 it looks doable.
>
> Hmm, I guess with an IP you could add the mandatory delimiter (usually 
>> ".") and repeat the group. But you would have to manually repeat the group 
>> at the end where the delimiter must not be.
>>
>
> That is quite easy in regex as you can make it just *"\.?"*. Repeat is 
> easy, just put the dot first on repeats.
>
> And then there's zero padding. Most of the IP numbers I've seen are not 
>> zero-padded, but ...
>>
>
> That is much more difficult in regex. So long as the system throws the 
> 0's away when not needed it may be okay?
>
> I think the first thing I would do is see what the internet says.
>>
>> A search for "regular expression ip address" immediately turns up a page 
>> from O'Reilly, with both a simple
>> version and an accurate version for checking IP. As I expected, they're 
>> able to do a repeat on the structure 3 times, but
>> have to do the last one by hand. They've figured out the 0 padding:
>>
>> ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
>>
>>
>> So ... no need to rebuild the wheel for most common use cases. Hmm, I 
>> wonder about IPv6 ?
>>
>
>
>> Ok, sorry for the stream-of-consciousness problem-working.
>>
>
> Its interesting & useful!
>
> TT
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0ec30d7d-d469-47eb-bb9f-11c412e1673b%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread Mohammad
Thanks Mark
Thanks Josiah,
 I correct the example in documentation wiki 
http://tw-regexp.tiddlyspot.com/

Both of you help to demystify regexp (very scary when you are familiar and 
look at its strange pattern!!) in Tiddlywiki.
I think (as Mat also noted)  a better understanding of regexp can help a 
lot for more efficient using of Tiddlywiki.

I will ask more questions and hope I have your answer, and hopefully I will 
gradually add them to the documentation wiki.

Cheers
Mohammad

On Sunday, August 25, 2019 at 11:36:08 PM UTC+4:30, Mark S. wrote:
>
> Most of your examples have an implied scope of the entire tiddler title.
>
> That is, if the tiddler can only have lower case letters, then *every 
> single character* from start to end (^ to $) has to be lowercase.
>
> But duplicate words can start and end anywhere inside the title, so the 
> scope doesn't have to apply to every single character.
>
> So, it was my fault for churning them out *en masse*, using previous 
> versions as my template ;-) 
>
> Thanks!
>
> On Sunday, August 25, 2019 at 11:44:56 AM UTC-7, Mohammad wrote:
>>
>> Thanks Mark and Josiah,
>>  It seems the problem is with *^$*.
>>
>> I removed them and it works. But not sure where they  are required.
>>
>> @Josiah,
>>  I add the consecutive duplicate words!
>>
>> Thank you again
>>
>> --Mohammad
>>
>> On Sunday, August 25, 2019 at 10:34:13 PM UTC+4:30, @TiddlyTweeter wrote:
>>>
>>> Mohammad 
>>>
>>> I'm not sure how much spaced repetition is an issue really ("I had an 
>>> old an clock")? The commonest issue is simple sequential repeating ("I had 
>>> an an ...").
>>>
>>> But Mark's regex works on test data. Though I'd simplify it to ...
>>>
>>> (\b\w{2,}\b)(.*)\1
>>>
>>> Example match in test data (match in lines)...
>>>
>>> *-> ... <- is match*
>>>
>>> (\b\w{2,}\b)(.*)\1 ... spaced duplicate words to remove↩︎
>>> ↩︎
>>> This is a Tiddler ->This<- is Nice↩︎
>>> Nice Tiddler is This ->Tiddler<-↩︎
>>> Remove this repeat of ->this<- Tiddler repeat of ->repeat<-.↩︎
>>>
>>>
>>> TT
>>>
>>> On Sunday, 25 August 2019 17:29:10 UTC+2, Mohammad wrote:

 The duplicate words does not work!

 It seems only if the first word of title repeated it will be matched. 
 Look at the below two tiddler titles


1. This is a Tiddler This is Nice
2. Nice Tiddler is This Tiddler

 The pattern will match the first but ignore the second while both have 
 a duplicate word!

 --Mohammad

 On Friday, August 23, 2019 at 10:51:06 PM UTC+4:30, Mark S. wrote:
>
> Ok, with duplicates and date formats. Note that the date formats only 
> check for the format. You could still create
> nonsensical dates that actually match the formats (Jan 55 , 
> .15.55). Actual validation of dates would take
> real code massaging.
>
> <$vars digonly="^[0-9]*$">
> <$vars useme=<>>
> 
> 
>
> <$select tiddler="myregexp">
> Only digits
> Only lower case
> Only upper case
> Only alphanumeric, _, and -
> Only alphanum len 3-15
> Starts with capital
> Starts with digit
> Extensions only
> Extension jpg gpeg
> Duplicate words
> Duplicate words
>  "^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s{1}\d{2}\s\d{4}$"
> >Date like Jan 06 2019
> Date like 2019.08.25
> 
> 
>
> <$list filter="[regexp{myregexp}sort[]]">
>
> 
>
>
>
> On Friday, August 23, 2019 at 12:11:07 AM UTC-7, Mohammad wrote:
>>
>> I am looking for examples and use cases of regexp in Tiddlywiki!
>> Those can be done current filter operators like prefix, search,... 
>> are not recommend to be done with regexp.
>>
>> I appreciate your help, case and examples on this. Just give what you 
>> want to do.
>>
>> Some case
>>
>> Give a regexp pattern in Tiddlywiki to match all tiddlers name are
>>
>>
>>1. only digits
>>2. only lowercase letters
>>3. only uppercase letters
>>4. only alphanumeric and underscore and hyphen
>>5. only alphanumeric with length between 3 and 15
>>6. start with a capital letter
>>7. start with a digit
>>8. have a extension like mytiddler.ext
>>9. have jpg or jpeg extension like *mytiddler.jpg* or 
>>*mytiddler.gpeg*
>>10. are a date in format like Jan 06 2019 
>>11. are a date in format like 2019.08.25 
>>12. have duplicate words
>>13. have a valid url
>>14. 
>>
>>
>> [This list will grow by more examples]
>>
>>
>> Please give your use case.
>>
>> -- Mohammad
>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread 'Mark S.' via TiddlyWiki
Most of your examples have an implied scope of the entire tiddler title.

That is, if the tiddler can only have lower case letters, then *every 
single character* from start to end (^ to $) has to be lowercase.

But duplicate words can start and end anywhere inside the title, so the 
scope doesn't have to apply to every single character.

So, it was my fault for churning them out *en masse*, using previous 
versions as my template ;-) 

Thanks!

On Sunday, August 25, 2019 at 11:44:56 AM UTC-7, Mohammad wrote:
>
> Thanks Mark and Josiah,
>  It seems the problem is with *^$*.
>
> I removed them and it works. But not sure where they  are required.
>
> @Josiah,
>  I add the consecutive duplicate words!
>
> Thank you again
>
> --Mohammad
>
> On Sunday, August 25, 2019 at 10:34:13 PM UTC+4:30, @TiddlyTweeter wrote:
>>
>> Mohammad 
>>
>> I'm not sure how much spaced repetition is an issue really ("I had an old 
>> an clock")? The commonest issue is simple sequential repeating ("I had an 
>> an ...").
>>
>> But Mark's regex works on test data. Though I'd simplify it to ...
>>
>> (\b\w{2,}\b)(.*)\1
>>
>> Example match in test data (match in lines)...
>>
>> *-> ... <- is match*
>>
>> (\b\w{2,}\b)(.*)\1 ... spaced duplicate words to remove↩︎
>> ↩︎
>> This is a Tiddler ->This<- is Nice↩︎
>> Nice Tiddler is This ->Tiddler<-↩︎
>> Remove this repeat of ->this<- Tiddler repeat of ->repeat<-.↩︎
>>
>>
>> TT
>>
>> On Sunday, 25 August 2019 17:29:10 UTC+2, Mohammad wrote:
>>>
>>> The duplicate words does not work!
>>>
>>> It seems only if the first word of title repeated it will be matched. 
>>> Look at the below two tiddler titles
>>>
>>>
>>>1. This is a Tiddler This is Nice
>>>2. Nice Tiddler is This Tiddler
>>>
>>> The pattern will match the first but ignore the second while both have a 
>>> duplicate word!
>>>
>>> --Mohammad
>>>
>>> On Friday, August 23, 2019 at 10:51:06 PM UTC+4:30, Mark S. wrote:

 Ok, with duplicates and date formats. Note that the date formats only 
 check for the format. You could still create
 nonsensical dates that actually match the formats (Jan 55 , 
 .15.55). Actual validation of dates would take
 real code massaging.

 <$vars digonly="^[0-9]*$">
 <$vars useme=<>>
 
 

 <$select tiddler="myregexp">
 Only digits
 Only lower case
 Only upper case
 Only alphanumeric, _, and -
 Only alphanum len 3-15
 Starts with capital
 Starts with digit
 Extensions only
 Extension jpg gpeg
 Duplicate words
 Duplicate words
 >>> "^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s{1}\d{2}\s\d{4}$">Date
  
 like Jan 06 2019
 Date like 2019.08.25
 

 <$list filter="[regexp{myregexp}sort[]]">

 



 On Friday, August 23, 2019 at 12:11:07 AM UTC-7, Mohammad wrote:
>
> I am looking for examples and use cases of regexp in Tiddlywiki!
> Those can be done current filter operators like prefix, search,... are 
> not recommend to be done with regexp.
>
> I appreciate your help, case and examples on this. Just give what you 
> want to do.
>
> Some case
>
> Give a regexp pattern in Tiddlywiki to match all tiddlers name are
>
>
>1. only digits
>2. only lowercase letters
>3. only uppercase letters
>4. only alphanumeric and underscore and hyphen
>5. only alphanumeric with length between 3 and 15
>6. start with a capital letter
>7. start with a digit
>8. have a extension like mytiddler.ext
>9. have jpg or jpeg extension like *mytiddler.jpg* or 
>*mytiddler.gpeg*
>10. are a date in format like Jan 06 2019 
>11. are a date in format like 2019.08.25 
>12. have duplicate words
>13. have a valid url
>14. 
>
>
> [This list will grow by more examples]
>
>
> Please give your use case.
>
> -- Mohammad
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0c23df1a-7c12-425c-974d-cadac1e9cbf3%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread @TiddlyTweeter
Mark S. wrote:
>
> I think he means "02" literally. Usually IP numbers aren't padded, so not 
> sure.
>
> It's the range 0-255 that's problematic. Here's what I have for the range:
>
> IP range 
> 0-256
>

IF that means numbers 000 to 255 it looks doable.

Hmm, I guess with an IP you could add the mandatory delimiter (usually ".") 
> and repeat the group. But you would have to manually repeat the group at 
> the end where the delimiter must not be.
>

That is quite easy in regex as you can make it just *"\.?"*. Repeat is 
easy, just put the dot first on repeats.

And then there's zero padding. Most of the IP numbers I've seen are not 
> zero-padded, but ...
>

That is much more difficult in regex. So long as the system throws the 0's 
away when not needed it may be okay?

I think the first thing I would do is see what the internet says.
>
> A search for "regular expression ip address" immediately turns up a page 
> from O'Reilly, with both a simple
> version and an accurate version for checking IP. As I expected, they're 
> able to do a repeat on the structure 3 times, but
> have to do the last one by hand. They've figured out the 0 padding:
>
> ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
>
>
> So ... no need to rebuild the wheel for most common use cases. Hmm, I 
> wonder about IPv6 ?
>


> Ok, sorry for the stream-of-consciousness problem-working.
>

Its interesting & useful!

TT

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f2449494-ad09-44fe-a4f6-ff056496a907%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread @TiddlyTweeter
Mohammad wrote:
>
>  It seems the problem is with *^$*.
>

There are definitely issues with "scope" in TW that are currently unclear.

Regex will fail, or do unexpected things, if its not fully clear what the 
context the regex is working in.

This needs clarifying IMO. 

TT

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/168e29ee-9707-4e47-941a-258ecb841745%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread Mohammad
Thanks Mark and Josiah,
 It seems the problem is with *^$*.

I removed them and it works. But not sure where they  are required.

@Josiah,
 I add the consecutive duplicate words!

Thank you again

--Mohammad

On Sunday, August 25, 2019 at 10:34:13 PM UTC+4:30, @TiddlyTweeter wrote:
>
> Mohammad 
>
> I'm not sure how much spaced repetition is an issue really ("I had an old 
> an clock")? The commonest issue is simple sequential repeating ("I had an 
> an ...").
>
> But Mark's regex works on test data. Though I'd simplify it to ...
>
> (\b\w{2,}\b)(.*)\1
>
> Example match in test data (match in lines)...
>
> *-> ... <- is match*
>
> (\b\w{2,}\b)(.*)\1 ... spaced duplicate words to remove↩︎
> ↩︎
> This is a Tiddler ->This<- is Nice↩︎
> Nice Tiddler is This ->Tiddler<-↩︎
> Remove this repeat of ->this<- Tiddler repeat of ->repeat<-.↩︎
>
>
> TT
>
> On Sunday, 25 August 2019 17:29:10 UTC+2, Mohammad wrote:
>>
>> The duplicate words does not work!
>>
>> It seems only if the first word of title repeated it will be matched. 
>> Look at the below two tiddler titles
>>
>>
>>1. This is a Tiddler This is Nice
>>2. Nice Tiddler is This Tiddler
>>
>> The pattern will match the first but ignore the second while both have a 
>> duplicate word!
>>
>> --Mohammad
>>
>> On Friday, August 23, 2019 at 10:51:06 PM UTC+4:30, Mark S. wrote:
>>>
>>> Ok, with duplicates and date formats. Note that the date formats only 
>>> check for the format. You could still create
>>> nonsensical dates that actually match the formats (Jan 55 , 
>>> .15.55). Actual validation of dates would take
>>> real code massaging.
>>>
>>> <$vars digonly="^[0-9]*$">
>>> <$vars useme=<>>
>>> 
>>> 
>>>
>>> <$select tiddler="myregexp">
>>> Only digits
>>> Only lower case
>>> Only upper case
>>> Only alphanumeric, _, and -
>>> Only alphanum len 3-15
>>> Starts with capital
>>> Starts with digit
>>> Extensions only
>>> Extension jpg gpeg
>>> Duplicate words
>>> Duplicate words
>>> >> "^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s{1}\d{2}\s\d{4}$">Date 
>>> like Jan 06 2019
>>> Date like 2019.08.25
>>> 
>>>
>>> <$list filter="[regexp{myregexp}sort[]]">
>>>
>>> 
>>>
>>>
>>>
>>> On Friday, August 23, 2019 at 12:11:07 AM UTC-7, Mohammad wrote:

 I am looking for examples and use cases of regexp in Tiddlywiki!
 Those can be done current filter operators like prefix, search,... are 
 not recommend to be done with regexp.

 I appreciate your help, case and examples on this. Just give what you 
 want to do.

 Some case

 Give a regexp pattern in Tiddlywiki to match all tiddlers name are


1. only digits
2. only lowercase letters
3. only uppercase letters
4. only alphanumeric and underscore and hyphen
5. only alphanumeric with length between 3 and 15
6. start with a capital letter
7. start with a digit
8. have a extension like mytiddler.ext
9. have jpg or jpeg extension like *mytiddler.jpg* or 
*mytiddler.gpeg*
10. are a date in format like Jan 06 2019 
11. are a date in format like 2019.08.25 
12. have duplicate words
13. have a valid url
14. 


 [This list will grow by more examples]


 Please give your use case.

 -- Mohammad



-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/82eb4bc4-c073-4b05-89c4-eab67c601227%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread @TiddlyTweeter
Mohammad 

I'm not sure how much spaced repetition is an issue really ("I had an old 
an clock")? The commonest issue is simple sequential repeating ("I had an 
an ...").

But Mark's regex works on test data. Though I'd simplify it to ...

(\b\w{2,}\b)(.*)\1

Example match in test data (match in lines)...

*-> ... <- is match*

(\b\w{2,}\b)(.*)\1 ... spaced duplicate words to remove↩︎
↩︎
This is a Tiddler ->This<- is Nice↩︎
Nice Tiddler is This ->Tiddler<-↩︎
Remove this repeat of ->this<- Tiddler repeat of ->repeat<-.↩︎


TT

On Sunday, 25 August 2019 17:29:10 UTC+2, Mohammad wrote:
>
> The duplicate words does not work!
>
> It seems only if the first word of title repeated it will be matched. Look 
> at the below two tiddler titles
>
>
>1. This is a Tiddler This is Nice
>2. Nice Tiddler is This Tiddler
>
> The pattern will match the first but ignore the second while both have a 
> duplicate word!
>
> --Mohammad
>
> On Friday, August 23, 2019 at 10:51:06 PM UTC+4:30, Mark S. wrote:
>>
>> Ok, with duplicates and date formats. Note that the date formats only 
>> check for the format. You could still create
>> nonsensical dates that actually match the formats (Jan 55 , 
>> .15.55). Actual validation of dates would take
>> real code massaging.
>>
>> <$vars digonly="^[0-9]*$">
>> <$vars useme=<>>
>> 
>> 
>>
>> <$select tiddler="myregexp">
>> Only digits
>> Only lower case
>> Only upper case
>> Only alphanumeric, _, and -
>> Only alphanum len 3-15
>> Starts with capital
>> Starts with digit
>> Extensions only
>> Extension jpg gpeg
>> Duplicate words
>> Duplicate words
>> > "^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s{1}\d{2}\s\d{4}$">Date 
>> like Jan 06 2019
>> Date like 2019.08.25
>> 
>>
>> <$list filter="[regexp{myregexp}sort[]]">
>>
>> 
>>
>>
>>
>> On Friday, August 23, 2019 at 12:11:07 AM UTC-7, Mohammad wrote:
>>>
>>> I am looking for examples and use cases of regexp in Tiddlywiki!
>>> Those can be done current filter operators like prefix, search,... are 
>>> not recommend to be done with regexp.
>>>
>>> I appreciate your help, case and examples on this. Just give what you 
>>> want to do.
>>>
>>> Some case
>>>
>>> Give a regexp pattern in Tiddlywiki to match all tiddlers name are
>>>
>>>
>>>1. only digits
>>>2. only lowercase letters
>>>3. only uppercase letters
>>>4. only alphanumeric and underscore and hyphen
>>>5. only alphanumeric with length between 3 and 15
>>>6. start with a capital letter
>>>7. start with a digit
>>>8. have a extension like mytiddler.ext
>>>9. have jpg or jpeg extension like *mytiddler.jpg* or 
>>>*mytiddler.gpeg*
>>>10. are a date in format like Jan 06 2019 
>>>11. are a date in format like 2019.08.25 
>>>12. have duplicate words
>>>13. have a valid url
>>>14. 
>>>
>>>
>>> [This list will grow by more examples]
>>>
>>>
>>> Please give your use case.
>>>
>>> -- Mohammad
>>>
>>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e2d92cfe-f778-4aeb-9884-cab5305e7795%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread 'Mark S.' via TiddlyWiki
I think he means "02" literally. Usually IP numbers aren't padded, so not 
sure.

It's the range 0-255 that's problematic. Here's what I have for the range:

IP range 
0-256

Hmm, I guess with an IP you could add the mandatory delimiter (usually ".") 
and repeat the group. But you would have to manually repeat the group at 
the end where the delimiter must not be.

And then there's zero padding. Most of the IP numbers I've seen are not 
zero-padded, but ...

I think the first thing I would do is see what the internet says.

A search for "regular expression ip address" immediately turns up a page 
from O'Reilly, with both a simple
version and an accurate version for checking IP. As I expected, they're 
able to do a repeat on the structure 3 times, but
have to do the last one by hand. They've figured out the 0 padding:

^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$


So ... no need to rebuild the wheel for most common use cases. Hmm, I 
wonder about IPv6 ?

Ok, sorry for the stream-of-consciousness problem-working.

Thanks!

On Sunday, August 25, 2019 at 6:16:56 AM UTC-7, @TiddlyTweeter wrote:
>
> TonyM wrote:
>>
>> [02][0-255][0-255][0-255]
>>
>> [192][168][0-255][0-255]
>>
>
> Do you mean "02" *literally?* In regex [02] means "0" OR "2". 
> The pattern can be matched I'm sure.
> But you need clarify what are "literals" & what are ranges.
>
> TT 
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/77999739-c09a-4edb-858a-9c350c7070fd%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread 'Mark S.' via TiddlyWiki
Try 

Duplicate words

On Sunday, August 25, 2019 at 8:29:10 AM UTC-7, Mohammad wrote:
>
> The duplicate words does not work!
>
> It seems only if the first word of title repeated it will be matched. Look 
> at the below two tiddler titles
>
>
>1. This is a Tiddler This is Nice
>2. Nice Tiddler is This Tiddler
>
> The pattern will match the first but ignore the second while both have a 
> duplicate word!
>
> --Mohammad
>
> On Friday, August 23, 2019 at 10:51:06 PM UTC+4:30, Mark S. wrote:
>>
>> Ok, with duplicates and date formats. Note that the date formats only 
>> check for the format. You could still create
>> nonsensical dates that actually match the formats (Jan 55 , 
>> .15.55). Actual validation of dates would take
>> real code massaging.
>>
>> <$vars digonly="^[0-9]*$">
>> <$vars useme=<>>
>> 
>> 
>>
>> <$select tiddler="myregexp">
>> Only digits
>> Only lower case
>> Only upper case
>> Only alphanumeric, _, and -
>> Only alphanum len 3-15
>> Starts with capital
>> Starts with digit
>> Extensions only
>> Extension jpg gpeg
>> Duplicate words
>> Duplicate words
>> > "^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s{1}\d{2}\s\d{4}$">Date 
>> like Jan 06 2019
>> Date like 2019.08.25
>> 
>>
>> <$list filter="[regexp{myregexp}sort[]]">
>>
>> 
>>
>>
>>
>> On Friday, August 23, 2019 at 12:11:07 AM UTC-7, Mohammad wrote:
>>>
>>> I am looking for examples and use cases of regexp in Tiddlywiki!
>>> Those can be done current filter operators like prefix, search,... are 
>>> not recommend to be done with regexp.
>>>
>>> I appreciate your help, case and examples on this. Just give what you 
>>> want to do.
>>>
>>> Some case
>>>
>>> Give a regexp pattern in Tiddlywiki to match all tiddlers name are
>>>
>>>
>>>1. only digits
>>>2. only lowercase letters
>>>3. only uppercase letters
>>>4. only alphanumeric and underscore and hyphen
>>>5. only alphanumeric with length between 3 and 15
>>>6. start with a capital letter
>>>7. start with a digit
>>>8. have a extension like mytiddler.ext
>>>9. have jpg or jpeg extension like *mytiddler.jpg* or 
>>>*mytiddler.gpeg*
>>>10. are a date in format like Jan 06 2019 
>>>11. are a date in format like 2019.08.25 
>>>12. have duplicate words
>>>13. have a valid url
>>>14. 
>>>
>>>
>>> [This list will grow by more examples]
>>>
>>>
>>> Please give your use case.
>>>
>>> -- Mohammad
>>>
>>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/9c4d7bb0-134b-401d-a736-0d5674fb2eba%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread Mohammad
The duplicate words does not work!

It seems only if the first word of title repeated it will be matched. Look 
at the below two tiddler titles


   1. This is a Tiddler This is Nice
   2. Nice Tiddler is This Tiddler

The pattern will match the first but ignore the second while both have a 
duplicate word!

--Mohammad

On Friday, August 23, 2019 at 10:51:06 PM UTC+4:30, Mark S. wrote:
>
> Ok, with duplicates and date formats. Note that the date formats only 
> check for the format. You could still create
> nonsensical dates that actually match the formats (Jan 55 , 
> .15.55). Actual validation of dates would take
> real code massaging.
>
> <$vars digonly="^[0-9]*$">
> <$vars useme=<>>
> 
> 
>
> <$select tiddler="myregexp">
> Only digits
> Only lower case
> Only upper case
> Only alphanumeric, _, and -
> Only alphanum len 3-15
> Starts with capital
> Starts with digit
> Extensions only
> Extension jpg gpeg
> Duplicate words
> Duplicate words
>  "^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s{1}\d{2}\s\d{4}$">Date 
> like Jan 06 2019
> Date like 2019.08.25
> 
>
> <$list filter="[regexp{myregexp}sort[]]">
>
> 
>
>
>
> On Friday, August 23, 2019 at 12:11:07 AM UTC-7, Mohammad wrote:
>>
>> I am looking for examples and use cases of regexp in Tiddlywiki!
>> Those can be done current filter operators like prefix, search,... are 
>> not recommend to be done with regexp.
>>
>> I appreciate your help, case and examples on this. Just give what you 
>> want to do.
>>
>> Some case
>>
>> Give a regexp pattern in Tiddlywiki to match all tiddlers name are
>>
>>
>>1. only digits
>>2. only lowercase letters
>>3. only uppercase letters
>>4. only alphanumeric and underscore and hyphen
>>5. only alphanumeric with length between 3 and 15
>>6. start with a capital letter
>>7. start with a digit
>>8. have a extension like mytiddler.ext
>>9. have jpg or jpeg extension like *mytiddler.jpg* or *mytiddler.gpeg*
>>10. are a date in format like Jan 06 2019 
>>11. are a date in format like 2019.08.25 
>>12. have duplicate words
>>13. have a valid url
>>14. 
>>
>>
>> [This list will grow by more examples]
>>
>>
>> Please give your use case.
>>
>> -- Mohammad
>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/5409e2b7-1102-4d89-a679-6fa8136de6dc%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread @TiddlyTweeter
TonyM wrote:
>
> [02][0-255][0-255][0-255]
>
> [192][168][0-255][0-255]
>

Do you mean "02" *literally?* In regex [02] means "0" OR "2". 
The pattern can be matched I'm sure.
But you need clarify what are "literals" & what are ranges.

TT 

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f67d8bfc-31a2-4489-bf5d-198a0710711c%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread TonyM
Thanks Josiah/TT

So this suggests to me I may be able to test if an IP address is valid or 
in a local domain -

[02][0-255][0-255][0-255]

[192][168][0-255][0-255]

Or variations there of?

Have you put together some examples of the basic methods in tiddlywiki?. 
One would be the \define of the regex string in a macro to accommodate [ ] 
and using then/else and empty message to respond to the result of a regex 
filter? etc...

Regards
Tony



On Sunday, August 25, 2019 at 10:56:20 PM UTC+10, @TiddlyTweeter wrote:
>
> TonyM
>
> A bit more. Slightly more advanced. You could do a "pseudo-range" in regex 
> like below.
>
> The regex uses "alternation", *"|", *to separate decade ranges, its a bit 
> like an OR construct. (Though in regex its a pattern that advances from 
> left to right, recusing through alternates, till there is a match, or not.)
>
> *[2][2-9] - *matches 22-29
> *[3-4][0-9] - *matches 30-49 (this could be any number of decades that 
> remain whole)
> *[5][0-5] - *matches 50-55
>
> *_Ages 22 -> 55_"^([2][2-9]|[3-4][0-9]|[5][0-5])$"*
> *  "->" indicates a match ... *
>
> _Age 22 -> 55_ regex: "^([2][2-9]|[3-4][0-9]|[5][0-5])$"↩︎
> ↩︎
> ... These should NOT match↩︎
> 21↩︎
> 56↩︎
> 300↩︎
> 4↩︎
> 05↩︎
> ... These should match↩︎
> ->22↩︎
> ->29↩︎
> ->30↩︎
> ->37↩︎
> ->40↩︎
> ->45↩︎
> ->55↩︎
>
>
> TT
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e5ce861a-6edc-4063-92ea-fa9932fdeb90%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread Mohammad
For date like 25th August 2019  1st January 2020  2nd February 2018 does 
the below pattern is correct?

\d{2}(st|nd|rd|th)\s{1}(January|February|March|April|May|June|July|August|
September|October|November|December)\s{1}\d{4}

These are kind of date is used by Tiddlywiki journal.

--Mohammad

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/50b59340-fad7-477d-96ea-b1476b8fbd32%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread @TiddlyTweeter
TonyM

A bit more. Slightly more advanced. You could do a "pseudo-range" in regex 
like below.

The regex uses "alternation", *"|", *to separate decade ranges, its a bit 
like an OR construct. (Though in regex its a pattern that advances from 
left to right, recusing through alternates, till there is a match, or not.)

*[2][2-9] - *matches 22-29
*[3-4][0-9] - *matches 30-49 (this could be any number of decades that 
remain whole)
*[5][0-5] - *matches 50-55

*_Ages 22 -> 55_"^([2][2-9]|[3-4][0-9]|[5][0-5])$"*
*  "->" indicates a match ... *

_Age 22 -> 55_ regex: "^([2][2-9]|[3-4][0-9]|[5][0-5])$"↩︎
↩︎
... These should NOT match↩︎
21↩︎
56↩︎
300↩︎
4↩︎
05↩︎
... These should match↩︎
->22↩︎
->29↩︎
->30↩︎
->37↩︎
->40↩︎
->45↩︎
->55↩︎


TT

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ceb4c803-452d-4231-9ba6-230b076b2ca3%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread @TiddlyTweeter
Mohammad

I think about it. And keeping is simple. If I can't keep it simple enough I 
won't do it.

It is actually a good case because it has *"small variations" *on e/E in 
the pattern.

TT

On Sunday, 25 August 2019 11:42:10 UTC+2, Mohammad wrote:
>
> Hi Josiah,
>  Mat explained it, BUT to keep it practical and simple I would only need 
> the below
>
>
>- _dp or _myprecision only appear at the end
>- decimal point can appear anywhere but not after _
>   - so a number like .123_dp is valid
>   - so a number like ._dp is valid
>   - so 1.23e4_dp is valid
>- e or E means exponent and it can be appeared only after decimal 
>point and before _precision
>   - so 1.23E4_dp is valid
>   - so 123.36589e11_wp is valid
>   - in standard the number before decimal pint is between 1 and 9 
>   (including) so 1.2356e7_dp
>
>
> Please note that these are documented for learning regexp in Tiddlywiki, 
> so we need keep them simple!
> Thanks!
>
>
> On Sunday, August 25, 2019 at 12:20:33 PM UTC+4:30, @TiddlyTweeter wrote:
>>
>> Ciao Mohammad
>>
>> To get a preciser match I'd like to know where in the number "e" can 
>> appear. 
>>
>> Is it *always* near the end? For instance ...
>>
>> +1.23e4_dp
>> -1.23e4_dp
>> 1.236e+5_dp
>> -1.23e-5_wp
>>
>> In these "e" is *left-offset* from "_" either 2 or 3. In that *always* 
>> the case?
>>
>> TT
>>
>> On Sunday, 25 August 2019 07:17:33 UTC+2, Mohammad wrote:
>>>
>>> Thanks Josiah,
>>>  It works great! The only point should be mentioned is it also matches 
>>> wrong cases, but considering a correct number it is not a big deal.
>>>
>>> Example
>>>
>>> eee_dp
>>> 1.23eee45_dp
>>> eee111.34_dp
>>>
>>> Note: A number with/without scientific notation starts with number or 
>>> float point like (1.23e3  or .123e3)
>>> so, one improvement is to prevent match against *e123*.
>>> the second improvement may be to prevent more than one *e*.
>>>
>>> Cheers
>>> Mohammad
>>>
>>>
>>>
>>>
>>> On Saturday, August 24, 2019 at 11:29:03 PM UTC+4:30, @TiddlyTweeter 
>>> wrote:

 Mohammad wrote:
>
> Yes, as Eric explained these are scientific notation. I forgot to add 
> they can have positive or negative sign like
>
> +1.23e4_dp
> -1.23e4_dp
>
> 1.236e+5_dp
> -1.23e-5_wp
>
  
 It is an interesting case. Like with the dates. It can be matched quite 
 simply by PATTERN. But the pattern will match things you might overlook.

 For the specific case a "pattern-match" for a field containing a string 
 (and only that) would be ...

 ^([\-+.0-9e]+_[A-Za-z]+)$

 This would likely be all you'd need??

 But it could be made more precise if needed. 

 Here is a test match (and one problem) ... the green arrow -> indicates 
 the match ...

 [image: Annotation 2019-08-24 205231.jpg]


 Its a fact regex isn't "determinate" in the same way normal code is. 
 That can lead to much confusion. Testing against data is the best way to 
 ensure a regex is good enough for its purpose.

 TT

>>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/06a43807-ee49-47fa-b8ed-84a5244d772d%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread @TiddlyTweeter
Mat wrote:
>
>
> P.S What is that noise? Is that Josiah screaming curses, pulling his hair 
> and smashing his computer?  ;-)
>

Tx Mat, Actually it's a change to be able to address issues in a way I can 
actually do with a sense of basic competence. :-). 

 J.
 

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/9988aaec-f602-4ece-9f56-f4cdee645a76%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread Mohammad
Hi Josiah,
 Mat explained it, BUT to keep it practical and simple I would only need 
the below


   - _dp or _myprecision only appear at the end
   - decimal point can appear anywhere but not after _
  - so a number like .123_dp is valid
  - so a number like ._dp is valid
  - so 1.23e4_dp is valid
   - e or E means exponent and it can be appeared only after decimal point 
   and before _precision
  - so 1.23E4_dp is valid
  - so 123.36589e11_wp is valid
  - in standard the number before decimal pint is between 1 and 9 
  (including) so 1.2356e7_dp
   

Please note that these are documented for learning regexp in Tiddlywiki, so 
we need keep them simple!
Thanks!


On Sunday, August 25, 2019 at 12:20:33 PM UTC+4:30, @TiddlyTweeter wrote:
>
> Ciao Mohammad
>
> To get a preciser match I'd like to know where in the number "e" can 
> appear. 
>
> Is it *always* near the end? For instance ...
>
> +1.23e4_dp
> -1.23e4_dp
> 1.236e+5_dp
> -1.23e-5_wp
>
> In these "e" is *left-offset* from "_" either 2 or 3. In that *always* 
> the case?
>
> TT
>
> On Sunday, 25 August 2019 07:17:33 UTC+2, Mohammad wrote:
>>
>> Thanks Josiah,
>>  It works great! The only point should be mentioned is it also matches 
>> wrong cases, but considering a correct number it is not a big deal.
>>
>> Example
>>
>> eee_dp
>> 1.23eee45_dp
>> eee111.34_dp
>>
>> Note: A number with/without scientific notation starts with number or 
>> float point like (1.23e3  or .123e3)
>> so, one improvement is to prevent match against *e123*.
>> the second improvement may be to prevent more than one *e*.
>>
>> Cheers
>> Mohammad
>>
>>
>>
>>
>> On Saturday, August 24, 2019 at 11:29:03 PM UTC+4:30, @TiddlyTweeter 
>> wrote:
>>>
>>> Mohammad wrote:

 Yes, as Eric explained these are scientific notation. I forgot to add 
 they can have positive or negative sign like

 +1.23e4_dp
 -1.23e4_dp

 1.236e+5_dp
 -1.23e-5_wp

>>>  
>>> It is an interesting case. Like with the dates. It can be matched quite 
>>> simply by PATTERN. But the pattern will match things you might overlook.
>>>
>>> For the specific case a "pattern-match" for a field containing a string 
>>> (and only that) would be ...
>>>
>>> ^([\-+.0-9e]+_[A-Za-z]+)$
>>>
>>> This would likely be all you'd need??
>>>
>>> But it could be made more precise if needed. 
>>>
>>> Here is a test match (and one problem) ... the green arrow -> indicates 
>>> the match ...
>>>
>>> [image: Annotation 2019-08-24 205231.jpg]
>>>
>>>
>>> Its a fact regex isn't "determinate" in the same way normal code is. 
>>> That can lead to much confusion. Testing against data is the best way to 
>>> ensure a regex is good enough for its purpose.
>>>
>>> TT
>>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/1a456092-041d-4d8d-be8a-5e35230fa4cf%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread @TiddlyTweeter
Very helpful!

On Sunday, 25 August 2019 11:21:01 UTC+2, Mat wrote:
>
> Here's a wikipedia article on scientific notation / E notation
>
> https://en.wikipedia.org/wiki/Scientific_notation
>
> <:-)
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b7ab869d-14ec-42b4-ae24-b6aeeabd72c1%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread @TiddlyTweeter
Ciao TonyM

Thanks. I now  better understand what you are trying to do. 

The example below illustrates (1) "matching magnitude" (that regex can do; 
it can become, sort-of, a peasant's "pseudo-range" :-); (2) "matching 
length". 
Ask if you need any clarification.

Because it uses *"[...]" *character classes they need to go into a variable 
BEFORE they get put into the operator, see: 
https://groups.google.com/d/msg/tiddlywiki/VFJS9eB9oV4/G14R6_clAQAJ

Note: the example ASSUMES the matching is of a single-string field.

*_Number 000 -> 799 _ "^([0-7][0-9][0-9])$" (must be exactly three numbers 
long)*
*   "->" indicates a match ...*

_Number 000 -> 799 _ "^([0-7][0-9][0-9])$" (must be exactly three numbers long)
  or, more compact ... 
_Number 000 -> 799 _ "^([0-7]\d\d)$" (must be exactly three numbers long)↩︎

... These should NOT match↩︎
800↩︎
27↩︎
8↩︎
... These should match↩︎
->799↩︎
->435↩︎
->000↩︎
->127


TT


On Sunday, 25 August 2019 05:25:33 UTC+2, TonyM wrote:
>
> Josiah,
>
> I see here  that 
> regex is not so good at ranges however it seems that determining the 
> magniture of a number may be easier. For example to test if the number in a 
> text!!reference or variable is one, two or three digits in size  and if you 
> test all three then you could test if the number is from 0 to 999 this may 
> be enough for a lot of applications. You may ask someone for their age and 
> you could eliminate someone entering their year of birth by mistake because 
> 1980 is > 999
>
> As suggested before the ability to write a quick test on a number that 
> will display a message if outside the range could be helpful.
>
> \define magnitude3() [regex[blah]]
> {{{ [subfilterelse[number too big]] }}}
>
> Where blah is a regex that tests if the input is a number of 3 digits 
> maximum 0-999
>
> Regards
> Tony
>
> On Saturday, August 24, 2019 at 8:02:55 PM UTC+10, @TiddlyTweeter wrote:
>>
>> Ciao TonyM
>>
>> Regex is best developed with concrete data. It has *no* maths ability. 
>> Everything is just a string of characters to it. 
>> But its often possible to match using pattern. It depends on working with 
>> example test data to ensure where it might work.
>>
>> So could you give a paragraph or two of test data?
>>
>> TT
>>
>> On Saturday, 24 August 2019 07:15:47 UTC+2, TonyM wrote:
>>>
>>> Mark/Josiah,
>>>
>>> Is there a simple way to test a number is in a range and or greater than 
>>> or less than?
>>>
>>> It would be nice to have a pattern to test if a number lies between or 
>>> equal to a number, even if we simply follow it with the new then or else 
>>> operators and or make use of the emptyMessage on the list. Sadly the reveal 
>>> greater than less than an equal to tests are somewhat limited and we do not 
>>> yet have greater than or less than filter operators although match is now a 
>>> form of equals.
>>>
>>> We may be able to have some tests like this
>>>
>>> {{{ [regex[input>A$>>
>>> Regards
>>> Tony
>>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d270a36b-63b5-4757-9e2c-7242faef1526%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread Mat
Here's a wikipedia article on scientific notation / E notation

https://en.wikipedia.org/wiki/Scientific_notation

<:-)

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/22bdf67b-55b9-4e50-abb4-57171f75247b%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread Mat
@TiddlyTweeter wrote:
>
>
> To get a preciser match I'd like to know where in the number "e" can 
> appear. 
>

 
Since it means "10^e", the "e" is "functionally" at the end but it might 
not appear to be since the exponent can be any number e.g

1.2e-334556.232564264  

(which means 1.2*10^-334)

The "e" itself is sometimes instead written "E" (maybe because old 
calculators can't easily show "e").

That the exponent can also contain a varied set of characters. In reality 
it can be any number of characters because they can be variables with 
arbitrary names but the common cases are limited. While my math knowledge 
is both limited and rusty, I'd say these are necessary to manage:

   - minus character e.g 1.2e-3
   - decimal period e.g 1.2e3.4
   - division character as in 1.2e3/4

I would think one can also write 1.2e.3 meaning 1.2e0.3. Of course, in many 
parts of Europe we write 1.2e0,3 (comma instead of period).

Beyond this maybe parentheses and constants like pi. There can also be 
other bases than 10 which, if memory serves (and it might not), is notated 
with a subindex on the e. This is not totally fringe but definitely 
"university level".

<:-)

P.S What is that noise? Is that Josiah screaming curses, pulling his hair 
and smashing his computer? Easy my friend, no need to cover it all. ;-)

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ab466bbe-a66d-47d7-abfb-3496ad19f5f6%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread @TiddlyTweeter
Ciao Mohammad

To get a preciser match I'd like to know where in the number "e" can 
appear. 

Its it *always* near the end? For instance ...

+1.23e4_dp
-1.23e4_dp
1.236e+5_dp
-1.23e-5_wp

In these "e" is *left-offset* from "_" either 2 or 3. In that *always* the 
case?

TT

On Sunday, 25 August 2019 07:17:33 UTC+2, Mohammad wrote:
>
> Thanks Josiah,
>  It works great! The only point should be mentioned is it also matches 
> wrong cases, but considering a correct number it is not a big deal.
>
> Example
>
> eee_dp
> 1.23eee45_dp
> eee111.34_dp
>
> Note: A number with/without scientific notation starts with number or 
> float point like (1.23e3  or .123e3)
> so, one improvement is to prevent match against *e123*.
> the second improvement may be to prevent more than one *e*.
>
> Cheers
> Mohammad
>
>
>
>
> On Saturday, August 24, 2019 at 11:29:03 PM UTC+4:30, @TiddlyTweeter wrote:
>>
>> Mohammad wrote:
>>>
>>> Yes, as Eric explained these are scientific notation. I forgot to add 
>>> they can have positive or negative sign like
>>>
>>> +1.23e4_dp
>>> -1.23e4_dp
>>>
>>> 1.236e+5_dp
>>> -1.23e-5_wp
>>>
>>  
>> It is an interesting case. Like with the dates. It can be matched quite 
>> simply by PATTERN. But the pattern will match things you might overlook.
>>
>> For the specific case a "pattern-match" for a field containing a string 
>> (and only that) would be ...
>>
>> ^([\-+.0-9e]+_[A-Za-z]+)$
>>
>> This would likely be all you'd need??
>>
>> But it could be made more precise if needed. 
>>
>> Here is a test match (and one problem) ... the green arrow -> indicates 
>> the match ...
>>
>> [image: Annotation 2019-08-24 205231.jpg]
>>
>>
>> Its a fact regex isn't "determinate" in the same way normal code is. That 
>> can lead to much confusion. Testing against data is the best way to ensure 
>> a regex is good enough for its purpose.
>>
>> TT
>>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/9553940a-7336-4abe-ae7b-f73545640752%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-25 Thread @TiddlyTweeter

>
> Mark S. wrote:
>>
>> My trick is to "flatten" the text before applying the target regular 
>> expression
>>
>> ...tiddlers...splitregexp[\n]join[ ]splitregexp ...
>>
>
> Mat wrote: 

> These nuggets should probably be in the official docs. While it "is about 
> regex, not TW" it IS about regex in a TW context which does mean extra 
> demands and quirks.
>

I think better documenting the specific way TW regex in OPERATORS work with 
the "scope" in "single string" fields v. the "multi-line" text field is 
important.

A lot of the solutions Mark & I gave are "single string" field orientated. 
When used in text field they may break. 

*There needs to been a better documented bridge between general JavaScript 
regex and the TW operators implementation. *Otherwise it could be confusing.

TT

 

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/cea291a6-3708-4e5f-9793-913cf1a9e33a%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread Mohammad
Thanks Josiah,
 It works great! The only point should be mentioned is it also matches 
wrong cases, but considering a correct number it is not a big deal.

Example

eee_dp
1.23eee45_dp
eee111.34_dp

Note: A number with/without scientific notation starts with number or float 
point like (1.23e3  or .123e3)
so, one improvement is to prevent match against *e123*.
the second improvement may be to prevent more than one *e*.

Cheers
Mohammad




On Saturday, August 24, 2019 at 11:29:03 PM UTC+4:30, @TiddlyTweeter wrote:
>
> Mohammad wrote:
>>
>> Yes, as Eric explained these are scientific notation. I forgot to add 
>> they can have positive or negative sign like
>>
>> +1.23e4_dp
>> -1.23e4_dp
>>
>> 1.236e+5_dp
>> -1.23e-5_wp
>>
>  
> It is an interesting case. Like with the dates. It can be matched quite 
> simply by PATTERN. But the pattern will match things you might overlook.
>
> For the specific case a "pattern-match" for a field containing a string 
> (and only that) would be ...
>
> ^([\-+.0-9e]+_[A-Za-z]+)$
>
> This would likely be all you'd need??
>
> But it could be made more precise if needed. 
>
> Here is a test match (and one problem) ... the green arrow -> indicates 
> the match ...
>
> [image: Annotation 2019-08-24 205231.jpg]
>
>
> Its a fact regex isn't "determinate" in the same way normal code is. That 
> can lead to much confusion. Testing against data is the best way to ensure 
> a regex is good enough for its purpose.
>
> TT
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/065c2733-724d-4d6f-a83a-5dc2eefda517%40googlegroups.com.


Re: [tw5] Re: Tiddlywiki and regexp

2019-08-24 Thread TonyM
Mark,

Thanks for this, I only just got to test this; A Test tiddler as follows is 
not working as I may expect it
zfdtshwfthf
Content
sfghn
Content2

sfghsfgh
Content3
sxgfhfgsdh

I would have hoped it would return
Content
Content2
Content3


If it was to return only the content between the ` and ` and not 
any other content from the test tiddler I could do this;
\define output()
<$vars realchars="[^\s]+">
<$list 
filter="[{test data}splitregexp[\n]join[ 
]splitregexp[]butfirst[1]splitregexp[]butlast[1]regexpaddprefix[]addsuffix[]]"
>



\end
<$wikify name=result text="<>">
<>

Which would find all list items in test (HTML copied from somewhere) and 
create a new list of only list (li) items in the HTML

Does that make sense?

Regards
Tony

On Friday, August 23, 2019 at 2:08:20 AM UTC+10, Mark S. wrote:
>
> Re your 2nd question, you can make the filter slightly more robust:
>
> [{test}splitregexp[\n]join[ ]splitregexp[]butfirst[1]splitregexp[ li>]butlast[1]regexp]
>
> Re your 1st question, I don't believe you can do this in a single filter. 
> It will probably take multiple lines if possible at all. Because, there are 
> no core tools
> for grabbing the actual text you want -- only for splitting. People have 
> done a lot with splitting, but it gets tedious.
>
> If you had a regular expression filter that could split and return groups 
> (e.g. #2963) then you could simply search for and lift out the  
> group and the content group in one regular expression.
>
> On Thursday, August 22, 2019 at 7:58:06 AM UTC-7, TonyM wrote:
>>
>> Mark - Wow,
>>
>> I will test it out tomorrow to see how far I can take it. 
>>
>> I hope it works for multi-line tags
>>
>> My interest would be also the option to return
>> line 3
>> line 2
>> line 1
>> or
>> line 3
>> line 2 
>> line 1 
>> Because keeping the valid tags can be made use of as well.
>>
>> Ahd also see how to handle If the list tag had a style eg > style="something"> it would be nice if we could return
>> line 1
>> or
>> line 1
>>
>> If so a lot can be done to extract useful content from html, even if just 
>> to summarise some content.
>>
>> Perhaps further resolution would help like > name=extract>content
>>
>> Or extract list items.
>>
>> Even without using html a tiddlers text field could use html block and 
>> inline elements https://www.w3schools.com/html/html_blocks.asp to 
>> structure the content, and with such a regex macro extract parts of the 
>> tiddler text such as say a prepared extract from the content, or an 
>> excerpt, or a config settings or more.
>>
>> Regards
>> Tony
>>
>>
>> On Friday, August 23, 2019 at 12:22:47 AM UTC+10, Mark S. wrote:
>>>
>>>
>>> There's that saying, "When all you have is a hammer, everything starts 
>>> to look like a nail."
>>>
>>> All we have is regex. It would be great to have some other tool for 
>>> extracting actual DOM-like structures the way you
>>> could with TW classic. But we don't have it.
>>>
>>> Actually, the tool we have for regexp is also a bit lacking. There's no 
>>> tool for directly lifting desired target text. The new splitregexp only 
>>> splits, it doesn't 
>>> return the text we want to find. Here's my version that does most 
>>> literally what you ask for
>>>
>>> <$vars realchars="[^\s]+">
>>> <$list filter="[{test}splitregexp[\n]join[ ]splitregexp[
>>> ]butfirst[1]splitregexp[]butlast[1]regexp]">
>>>
>>> 
>>> 
>>>
>>> Input:
>>>
>>> More text here
>>> line 3
>>> line 2
>>> line 1
>>> More text there
>>>
>>> Output
>>>
>>>
>>> line 3 
>>> line 2 
>>> line 1 
>>>
>>>
>>>
>>> Good luck!
>>>
>>> On Thursday, August 22, 2019 at 2:21:34 AM UTC-7, TonyM wrote:

 Jeremy,

 You are aware I do not want so much to parse it as locate the content 
 between matching tags.

 Its intention is to access content delimited by html tags inside the 
 text content.

 Perhaps we could use it to retrieve items between the section div tags 
 or all instances of text between the li tags.

 Regards
 Tony



-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e7272cb1-b215-4c85-9298-8bcf612f5460%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread TonyM
Josiah,

I see here  that 
regex is not so good at ranges however it seems that determining the 
magniture of a number may be easier. For example to test if the number in a 
text!!reference or variable is one, two or three digits in size  and if you 
test all three then you could test if the number is from 0 to 999 this may 
be enough for a lot of applications. You may ask someone for their age and 
you could eliminate someone entering their year of birth by mistake because 
1980 is > 999

As suggested before the ability to write a quick test on a number that will 
display a message if outside the range could be helpful.

\define magnitude3() [regex[blah]]
{{{ [subfilterelse[number too big]] }}}

Where blah is a regex that tests if the input is a number of 3 digits 
maximum 0-999

Regards
Tony

On Saturday, August 24, 2019 at 8:02:55 PM UTC+10, @TiddlyTweeter wrote:
>
> Ciao TonyM
>
> Regex is best developed with concrete data. It has *no* maths ability. 
> Everything is just a string of characters to it. 
> But its often possible to match using pattern. It depends on working with 
> example test data to ensure where it might work.
>
> So could you give a paragraph or two of test data?
>
> TT
>
> On Saturday, 24 August 2019 07:15:47 UTC+2, TonyM wrote:
>>
>> Mark/Josiah,
>>
>> Is there a simple way to test a number is in a range and or greater than 
>> or less than?
>>
>> It would be nice to have a pattern to test if a number lies between or 
>> equal to a number, even if we simply follow it with the new then or else 
>> operators and or make use of the emptyMessage on the list. Sadly the reveal 
>> greater than less than an equal to tests are somewhat limited and we do not 
>> yet have greater than or less than filter operators although match is now a 
>> form of equals.
>>
>> We may be able to have some tests like this
>>
>> {{{ [regex[input>A$>
>> Regards
>> Tony
>>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f832f6cf-3012-4510-9920-9f606505bd92%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread Mat
@TiddlyTweeter wrote:
>
>  (<\/?[\w\s]*>|<.+[\W]>) ...
>

Thank you for the description. If I have a specific html tag - or a 
specific $widgettag for that matter! - how would the expression be modified?

<:-)

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e15d6620-f50a-41df-a36e-8f47e54c344c%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread Mat
@TiddlyTweeter wrote
 

> Is you aim here to CHANGE them?
>

I'm not sure what you mean. If you're referring to the @@... @@ then the 
idea, or I should say; then *one* idea is to be able to extract and get a 
list of all applied custom styles. @Mohammad asked for use case so I tried 
to think back about situations I've stumbled in - so the requests are a bit 
hypothetical at this point in time. 

I do know I will need these things for when I update the CherryPicker 
 and @ttention 
 plugins. I hope these regexes will help 
to split out parts of strings in a better way than how this is currently 
done and also to be able to implement some of the "future ideas" listed in 
the CherryPicker plugin.

<:-)

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/29689ea9-7a59-4fa4-8f28-859f86cdce62%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread Mat
Mark S. wrote:
>
> My trick is to "flatten" the text before applying the target regular 
> expression
>
> ...tiddlers...splitregexp[\n]join[ ]splitregexp ...
>

Clever!

These nuggets should probably be in the official docs. While it "is about 
regex, not TW" it IS about regex in a TW context which does mean extra 
demands and quirks.

<:-) 

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f52658f4-7fc3-472b-b358-b3c592173e09%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread @TiddlyTweeter
Mat to convert that ...

1. remove the leading and trailing *"/"* slashes. Those are for using regex 
in raw form in Javascript we don't use in TW operators, so: 
<\/?[\w\s]*>|<.+[\W]>

2. I see it uses "alternation". Not a bad idea to wrap it in brackets so: 
(<\/?[\w\s]*>|<.+[\W]>)

3. put it in a variable as it contains [...] brackets. (You know how to do 
that :-)

4. reference the variable in the regex [regexp:text[]]

Did it work? :-)

TT

On Saturday, 24 August 2019 20:16:54 UTC+2, Mat wrote:
>
> On https://digitalfortress.tech/tricks/top-15-commonly-used-regex/ I 
> found the following:
>
> 10. HTML Tags
>
>- Elements with Attributes  
>/<\/?[\w\s]*>|<.+[\W]>/
>
> How would this be applied in TW? I.e what to write here:
>
> {{{ [regexp:text[..]] }}}
>
>
> Side note: This is probably the first thing the TW docs should answer, i.e 
> "How to reformat regexps so they can be used in TW"
>
> Thank you!
>
> <:-)
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d875adcf-c6d3-4ed6-8596-e55845a319ae%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread @TiddlyTweeter
Mohammad wrote:
>
> Yes, as Eric explained these are scientific notation. I forgot to add they 
> can have positive or negative sign like
>
> +1.23e4_dp
> -1.23e4_dp
>
> 1.236e+5_dp
> -1.23e-5_wp
>
 
It is an interesting case. Like with the dates. It can be matched quite 
simply by PATTERN. But the pattern will match things you might overlook.

For the specific case a "pattern-match" for a field containing a string 
(and only that) would be ...

^([\-+.0-9e]+_[A-Za-z]+)$

This would likely be all you'd need??

But it could be made more precise if needed. 

Here is a test match (and one problem) ... the green arrow -> indicates the 
match ...

[image: Annotation 2019-08-24 205231.jpg]


Its a fact regex isn't "determinate" in the same way normal code is. That 
can lead to much confusion. Testing against data is the best way to ensure 
a regex is good enough for its purpose.

TT

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/46178133-fda1-4526-aed6-df2c1e00c49a%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread @TiddlyTweeter
Mat

Is you aim here to CHANGE them?

If it is to change them then I think the regex section of Tiddler Commander 
is better suited to that.

TT

On Saturday, 24 August 2019 20:08:59 UTC+2, Mat wrote:
>
> @TiddlyTweeter wrote:
>>
>>
>> Match between "@@" pairs
>>
>> The *"+?"* is to make the match "lazy" so it won't extend beyond the 
>> second @@ to a third pair of @@.
>> The content between them is passed to a "capturing group".
>>
>
> Thank you - but: 
>
> If the match needs to span lines regex settings may need tweaking.
>>
>
> In deed, this common case is not found AFAICT:
>
> @@.mystyle
> foo bar
> @@
>
> <:-)
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/138611ee-3b23-4958-89a5-d2bff6cb381f%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread 'Mark S.' via TiddlyWiki
I believe almost all of these will work out of the box. The exception is 
the square brackets. The workaround
is to put your regular expression in a variable first. This is mentioned in 
the docs for regexp :

The filter syntax  makes it 
> impossible to directly specify a regular expression that contains square 
> brackets. The solution is to store the expression in a variable 
> . See the examples 
> .
>

Thanks!

On Saturday, August 24, 2019 at 11:16:54 AM UTC-7, Mat wrote:
>
> On https://digitalfortress.tech/tricks/top-15-commonly-used-regex/ I 
> found the following:
>
> 10. HTML Tags
>
>- Elements with Attributes  
>/<\/?[\w\s]*>|<.+[\W]>/
>
> How would this be applied in TW? I.e what to write here:
>
> {{{ [regexp:text[..]] }}}
>
>
> Side note: This is probably the first thing the TW docs should answer, i.e 
> "How to reformat regexps so they can be used in TW"
>
> Thank you!
>
> <:-)
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f2e31ab7-a6d5-4804-82fb-ba3705e7c9d1%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread @TiddlyTweeter

>
> Mat:  the first thing the TW docs should answer, i.e "How to reformat 
> regexps so they can be used in TW"
>

You can't use regex "character classes" directly in the operator as the 
string contains the "TW reserved characters" *"[...]" *it needs itself. 

You have to "pass-in" anything regex in square brackets via a variable. 
See: https://tiddlywiki.com/#regexp%20Operator%20(Examples)

Basically like this ...

<$set name="digit-pattern" value="[0-9]{2}">
<]">>



TT





-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/c457a041-ad1f-4e12-a0b2-2d75a8496faa%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread 'Mark S.' via TiddlyWiki
My trick is to "flatten" the text before applying the target regular 
expression

...tiddlers...splitregexp[\n]join[ ]splitregexp ...

It sometimes works ;-)

On Saturday, August 24, 2019 at 11:08:59 AM UTC-7, Mat wrote:
>
> @TiddlyTweeter wrote:
>>
>>
>> Match between "@@" pairs
>>
>> The *"+?"* is to make the match "lazy" so it won't extend beyond the 
>> second @@ to a third pair of @@.
>> The content between them is passed to a "capturing group".
>>
>
> Thank you - but: 
>
> If the match needs to span lines regex settings may need tweaking.
>>
>
> In deed, this common case is not found AFAICT:
>
> @@.mystyle
> foo bar
> @@
>
> <:-)
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/21ff4b1c-b63f-4e1b-91a6-c8b1a35ec40f%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread Mat
On https://digitalfortress.tech/tricks/top-15-commonly-used-regex/ I found 
the following:

10. HTML Tags
   
   - Elements with Attributes  
   /<\/?[\w\s]*>|<.+[\W]>/

How would this be applied in TW? I.e what to write here:

{{{ [regexp:text[..]] }}}


Side note: This is probably the first thing the TW docs should answer, i.e 
"How to reformat regexps so they can be used in TW"

Thank you!

<:-)

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ac38fdfe-9e91-4a60-b7f3-f1d65a5a85f1%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread Mat
@TiddlyTweeter wrote:
>
>
> Match between "@@" pairs
>
> The *"+?"* is to make the match "lazy" so it won't extend beyond the 
> second @@ to a third pair of @@.
> The content between them is passed to a "capturing group".
>

Thank you - but: 

If the match needs to span lines regex settings may need tweaking.
>

In deed, this common case is not found AFAICT:

@@.mystyle
foo bar
@@

<:-)

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/95f8d01c-ffc2-47e9-822d-509438821b6b%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread @TiddlyTweeter
Mat wrote:
>
> (The attached image doesn't seem to work tho.)
>

Eeek,  It shows for me. Its a shame as regex is much easier to understand 
when you see its effect on actual data.

TT


-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/09cb7868-3172-47a1-90b3-00ad54e1d4ff%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread Mat
@TiddlyTweeter wrote:
>
> ([ .,;:!?]|$)
>
>  Note that in character classes meta-characters *"."* and *"?" *no longer 
> have any special meaning so do not need to be escaped.
> *"|"* is "alternation" within a "capture group" "*(...)*"
> *"$"* is "end-of-scope" (depends on regex setting whether that is 
> end-of-field or end-of-line)
>

Very valuable info that I had no idea about!
(The attached image doesn't seem to work tho.)

<:-)

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b41cac00-3113-45e0-bdc2-853c771ac607%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread Mat
@TiddlyTweeter wrote:
>
>
>>1. from X until the end of the sentence
>>2. ...until the end of the paragraph
>>3. ...until the end of the text field
>>
>> The exact regex may differ according to the context (type of field, does 
> it have line-breaks?, what are the regex settings?) ... 
>

"type of field" - as in multi-line vs single line? I did not realize this 
can affect a search. And what does "regex setting" mean?

Thank you for the provided code!

<:-)

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/c8a1048f-9e6f-4501-b2e1-3a215015f9fb%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread Mohammad
Yes, as Eric explained these are scientific notation. I forgot to add they 
can have positive or negative sign like

+1.23e4_dp
-1.23e4_dp

1.236e+5_dp
-1.23e-5_wp



On Saturday, August 24, 2019 at 8:02:46 PM UTC+4:30, @TiddlyTweeter wrote:
>
> By "number" do you mean everything before the "_"? So "1.234e5" is a 
> number?
>
> On Saturday, 24 August 2019 17:23:55 UTC+2, Mohammad wrote:
>>
>> What is the regexp pattern (one pattern) to match any of of below numbers
>>
>> 1234_dp
>> 12.34_dp
>> 1234._dp
>>
>> 1234e5_dp
>> 1.234e5_dp
>>
>>
>>
>>
>> Note wp or dp can be any kind of string (only a-zA-Z not hyphen not 
>> underscore) like _myPrecison 
>> These are numbers with user defined precision used *fortran*!
>>
>> --Mohammad
>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/25520407-545c-4f2d-958d-e35e7a986204%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread @TiddlyTweeter

>
> Mark S. wrote:
>>>
>>>
 TT: Lol! Nice one! I'd put that in the REALLY ADVANCED category for 
>> regex!
>> Most users would have no clue how that works!
>> Anyway I think you got it off the net? It's not bad, but faulty :-).
>>
>>
> Actually, I rolled it myself. 
>

WOW! That's impressive. It took me days!  

TT

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0553201d-3c57-4f61-b780-e4f880d4bd51%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread 'Mark S.' via TiddlyWiki


On Saturday, August 24, 2019 at 6:36:54 AM UTC-7, @TiddlyTweeter wrote:
>
> Mark S. wrote:
>>
>> Here's a probably inefficient date VALIDATOR for dates starting 
>>> -01-01 following format -mm-dd  (which I find to be the most 
>>> generally useful). Ok, I didn't check the rules. I think there's something 
>>> about a surprise
>>>
>> leap year every 400 years, so there's probably more tweaking to be done 
>> to match the Gregorian calendar precisely.
>>
>> > value="^(?=\d{4})(((?!\d\d(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96))\d{4}-(((0[13578]|10|12)-(0[1-9]|[12]\d|30|31))|((04|06|09|11)-(0[1-9]|[12]\d|30))|((02)-(0[1-9]|1\d|2[1-8]|((?=\d\d(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96))\d{4}-(((0[13578]|10|12)-(0[1-9]|[12]\d|30|31))|((04|06|09|11)-(0[1-9]|[12]\d|30))|((02)-(0[1-9]|1\d|2[1-9])">Experimental
>>  
>> VALIDATE -mm-dd
>>
>>  
> Lol! Nice one! I'd put that in the REALLY ADVANCED category for regex!
> Most users would have no clue how that works!
> Anyway I think you got it off the net? It's not bad, but faulty :-).
>
>
Actually, I rolled it myself. 

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d45ba6ea-c980-40f2-99b9-a49877e63d32%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread Eric Shulman
On Saturday, August 24, 2019 at 9:00:43 AM UTC-7, @TiddlyTweeter wrote:
>
> By "number" do you mean everything before the "_"? So "1.234e5" is a 
>> number?
>>
> I see "e" in the number -- is it  hexadecimal number? Or is the "e" for 
> something else?
>

That is a regular number, using "scientific notation".

1.234e5 means "1.234 times 10^5", i.e., 1.234 x 1 = 123400

-e


 

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6e68bf44-647c-4f13-8140-c3d88f36bfe2%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread @TiddlyTweeter

>
> By "number" do you mean everything before the "_"? So "1.234e5" is a 
> number?
>

I see "e" in the number -- is it  hexadecimal number? Or is the "e" for 
something else?
 

>
> On Saturday, 24 August 2019 17:23:55 UTC+2, Mohammad wrote:
>>
>> What is the regexp pattern (one pattern) to match any of of below numbers
>>
>> 1234_dp
>> 12.34_dp
>> 1234._dp
>>
>> 1234e5_dp
>> 1.234e5_dp
>>
>>
>>
>>
>> Note wp or dp can be any kind of string (only a-zA-Z not hyphen not 
>> underscore) like _myPrecison 
>> These are numbers with user defined precision used *fortran*!
>>
>> --Mohammad
>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/fba58f28-0cc6-42dc-baa0-f8798cd2c89d%40googlegroups.com.


[tw5] Re: Tiddlywiki and regexp examples

2019-08-24 Thread @TiddlyTweeter
By "number" do you mean everything before the "_"? So "1.234e5" is a number?

On Saturday, 24 August 2019 17:23:55 UTC+2, Mohammad wrote:
>
> What is the regexp pattern (one pattern) to match any of of below numbers
>
> 1234_dp
> 12.34_dp
> 1234._dp
>
> 1234e5_dp
> 1.234e5_dp
>
>
>
>
> Note wp or dp can be any kind of string (only a-zA-Z not hyphen not 
> underscore) like _myPrecison 
> These are numbers with user defined precision used *fortran*!
>
> --Mohammad
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/779a231d-c922-4d21-81b1-3a418a92b5e8%40googlegroups.com.


  1   2   >