Chuck,

Yes, there's an operator just for this scenario!

The regular expression operator: =~

Mike

On Fri, Jul 10, 2009 at 10:34 AM, <[email protected]> wrote:

>
> I'm fairly new to Ruby, and I have a usage question.
>
> There are times when I want to know if a regular expression matches a given
> input.  For example:
>
> class String
>        def containsVowel?
>                /[AEIOU]/i === self
>        end
> end
>
> Is there a common Ruby idiom for this, or is using the case operator this
> way the norm?
>
> -- Chuck
>
> --
> Chuck Durfee
> Sr. Internet Software Developer
> TSYS iSolutions, Golden
> Email [email protected]
>
> ------------------------------
>
> * The information contained in this communication (including any
> attachments hereto) is confidential and is intended solely for the personal
> and confidential use of the individual or entity to whom it is addressed. If
> the reader of this message is not the intended recipient or an agent
> responsible for delivering it to the intended recipient, you are hereby
> notified that you have received this communication in error and that any
> review, dissemination, copying, or unauthorized use of this information, or
> the taking of any action in reliance on the contents of this information is
> strictly prohibited. If you have received this communication in error,
> please notify us immediately by e-mail, and delete the original message.
> Thank you *
>
> _______________________________________________
> Ironruby-core mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>


-- 
Michael Harrington | Software Apprentice
Atomic Object | http://atomicobject.com
[Ph] +1 616 776 6020 [Fx] +1 616 776 6015
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to