Hi –
On Sun, 10 Sep 2006, Ben J. wrote:
I’m sure the last thing you would want your client to do is lear regular
expressions and how to write them. I have a scenario where I need to
filter results retireved from my program. The results can contain
letters, numbers, or both. The problem is that he needs to filter them
using ranges, exact matches, etc. Obviously regular expressions can do
this.
Here is my main problem: He needs to do 15-90. You can’t do 15-90 in a
regular expression.
Do you mean matching any integer from 15-90? If so, you could use
something like:
/\b(?:1[5-9])|(?:[2-8][0-9])|90\b/
But I can understand that you don’t expect your client to come up with
that
Basically I need an alternative to regular expressions that my client
can understand, but still gives him the ability to do some complex
comparisons.
Any ideas?
There was a library called Regexp::English, by Florian G., though I
can’t find it any more. I’m not sure whether it would help,
though… It gives you an English-language way to build patterns,
but you still have to know what you’re building.
I suspect you might be best off creating some kind of little wrapper
language yourself.
David
Thanks for your help.
–
Posted via http://www.ruby-forum.com/.
–
David A. Black | [email protected]
Author of “Ruby for Rails” [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB’s Weblog) [2] | Co-director, Ruby Central, Inc. [4]
[1] Ruby for Rails | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com | [4] http://www.rubycentral.org