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

Reply via email to