numeric-ranges

Regex to match 2-10, but not 99

I have a field on a form that takes the following values: -1, 2-10, 99 I have a business rule that's concerned with answers 2-10. I'm trying to write a regular expression that will match 2-10 but not 99, and I'm having trouble. The original expression: ^2|3|4|5|6|7|8|9|10$ Fails because 99 is matched (technically, twice). Also, th...

Interpreting Number Ranges in Python

In a Pylons webapp, I need to take a string such as "<3, 45, 46, 48-51, 77" and create a list of ints (which are actually IDs of objects) to search on. Any suggestions on ways to do this? I'm new to Python, and I haven't found anything out there that helps with this kind of thing. The list would be: [1, 2, 3, 45, 46, 48, 49, 50, 51, 7...

How to index numeric fields and search them by range in Lucene.Net ?

I'm looking for an efficient way to index and search numeric fields in Lucene.Net. Right now my need is for integer values only. I want to search by ranges of values (between x and y, more than x...). Right now I'm indexing the number as is and manually creating clauses for each value in between the two values, but it quickly generates ...