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. 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? Thanks for your help. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org
2006-Sep-10 20:39 UTC
Re: Having your clients write regular expressions...
Hi -- On Sun, 10 Sep 2006, Ben Johnson 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 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> Thanks for your help. > > -- > Posted via http://www.ruby-forum.com/. > > >-- David A. Black | dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB''s Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Daniel Higginbotham
2006-Sep-10 20:41 UTC
Re: Having your clients write regular expressions...
Check out ez_where, http://www.brainspl.at/articles/2006/06/30/new-release-of-ez_where-plugin It might help with you range problem or you could do /(1[5-9]|[2-8]\d|90)/ which might not be the best way of matching that but i believe it''ll work On Sunday 10 September 2006 10:20 am, Ben Johnson 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. > > 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? > > Thanks for your help.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Let them provide the SQL where clauses? On 10/09/06, Daniel Higginbotham <daniel-4cOk6EWy6wjNj93mkU9IYrqjc7CnNF17@public.gmane.org> wrote:> > > Check out ez_where, > http://www.brainspl.at/articles/2006/06/30/new-release-of-ez_where-plugin > > It might help with you range problem > > or you could do > > /(1[5-9]|[2-8]\d|90)/ which might not be the best way of matching that but > i > believe it''ll work > > On Sunday 10 September 2006 10:20 am, Ben Johnson 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. > > > > 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? > > > > Thanks for your help. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Daniel Higginbotham
2006-Sep-10 21:50 UTC
Re: Having your clients write regular expressions...
It could be a Very Bad Idea, but either way the plugin''s really nifty. On Sunday 10 September 2006 11:18 am, Ian Leitch wrote:> Let them provide the SQL where clauses? > > On 10/09/06, Daniel Higginbotham <daniel-4cOk6EWy6wjNj93mkU9IYrqjc7CnNF17@public.gmane.org> wrote: > > Check out ez_where, > > http://www.brainspl.at/articles/2006/06/30/new-release-of-ez_where-plugin > > > > It might help with you range problem > > > > or you could do > > > > /(1[5-9]|[2-8]\d|90)/ which might not be the best way of matching that > > but i > > believe it''ll work > > > > On Sunday 10 September 2006 10:20 am, Ben Johnson 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. > > > > > > 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? > > > > > > Thanks for your help. > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Ian Leitch wrote:> Let them provide the SQL where clauses?What I''m doing doesn''t interact with the database at all. I just need to filter results that I retrieve. I have no control over what I receive, which is why I need to filter with regular expressions. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Eero Saynatkari
2006-Sep-10 22:50 UTC
Re: Having your clients write regular expressions...
Ben Johnson wrote:> Ian Leitch wrote: >> Let them provide the SQL where clauses? > > What I''m doing doesn''t interact with the database at all. I just need to > filter results that I retrieve. I have no control over what I receive, > which is why I need to filter with regular expressions.Regexps cannot do everything for you. Use the regexp to find out *whether* there are numbers and then match against a Range constructed from the 15-19 syntax. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---