Re: Doing an AND in regexp char class
by 7stud -- other posts by this author
May 9 2008 3:10AM messages near this date
Re: Doing an AND in regexp char class
|
Re: Doing an AND in regexp char class
David A. Black wrote:
> Hi --
>
> On Fri, 9 May 2008, 7stud -- wrote:
>
> >>>> false
> >> else
> >
> > puts
> > passes your test, it is not true that all the characters in the string
> > "abc" appear in in the string "aaa".
>
> Do it the other way around (and don't forget the \z):
>
Whoops.
> if /\A[#{str}]*\z/ =~ chars
>
> It's really the characters in str that you're testing, to make sure
> that none of them fail to match the characters in chars. If the
> variable names seem backwards, you can change them. It's the logic
> that's important, and it works fine.
>
Nice.
--
Posted via http://www.ruby-forum.com/.
Thread:
Todd Benson
Rick DeNatale
Ara.T.Howard
Pit Capitain
Todd Benson
Joel VanderWerf
7stud --
David A. Black
7stud --
Todd Benson
David A. Black
Joel VanderWerf
Todd Benson
David A. Black
Joel VanderWerf
David A. Black
Ara.T.Howard
Robert Dober
|