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

Reply via email to