Having your clients write regular expressions...

Hi --

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 :slight_smile:

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 Gross, 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