Outliner Software Forum RSS Feed Forum Posts Feed

Subscribe by Email

CRIMP Defined

 

Tip Jar

Advice on research software

View this topic | Back to topic list

Posted by 22111
Aug 22, 2013 at 09:14 AM

 

Regex (correction of the above)

It is obvious regex (as in KEdit), for numeric ranges, is extremely helpful (when in AS for example, only very short ranges could be replaced by a bunch of “AND” “searches”), but my description above was wrong. I try again:

If you do not have integers but numbers with decimal point/comma, you will have regex only consider the part before the point/comma, in most cases.

1)
For most ranges, one single “search” would be sufficient:
range 100-600
search for 3 digits (not also 2 or 4) and beginning with 1-6

2)
range 70-120
here indeed, regex experts would be able to do it in just one “search”, when beginners like we are would do it in two, combined with an “AND”:
(search for 2 digits and beginning with 7-9) OR (search for 3 digits beginning with 1 and then second digit 0 or 1)
this will only cover numbers up to 119, so if you really need 120, too, in this example, you have to combine a third search, for 120, with a second “AND”

3)
In my example of the post above, I wanted to express a different approach but got it totally wrong. You would search for a range by excluding (!) both the lesser numers, and the numbers too big for the range, but this would be done by a combination of two, three, four or even more searches:

(I mix up () and [] for better reading)

range 110-600
[3 digits] AND [ (first=2-5) OR (first=1 AND NOT second=0) OR (first=6 AND second and third =0 each) ]

or a last example, 110-1100
( [3 digits] AND [ (first=2-5) OR (first=1 AND NOT second=0) ] ) OR ( [4 digits] AND [ (second=0) OR (second=1 AND third = 0 AND fourth=0) ] )

So such Boolean / regex constructions are not beautiful and are easily gotten wrong (and without your knowing, then delivering wrong results), but at least, it is possible to “search for” numeric ranges (in fact, to select lines with values within those ranges) this way if your tool both provides Boolean search (or, as in KEdit, cascading searches/selections) and regex.

In most cases, your ranges will not be totally aleatoric, but will be some standard ranges again and again, and for such purposes, you will have to construct your search once, and then put it into your tool by a macro, for any further use.

So this is a viable solution for many such analysing tasks if you don’t have dedicated software at your disposition.