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 <https://www.regular-expressions.info/numericranges.html> 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]] > {{{ [<var>subfilter<magnitude3>else[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 >>> >>> {{{ [<number>regex[input>A$<B]else[out of range]] }}} >>> >>> 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d270a36b-63b5-4757-9e2c-7242faef1526%40googlegroups.com.

