Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > regex does not contain - or no match

Reply
Thread Tools

regex does not contain - or no match

 
 
Sergio Ruiz
Guest
Posts: n/a
 
      02-17-2009
okay, for some reason, i am not getting this.. i am feeling very
stupid..

i am trying to find a case where the regex does NOT match..

i have tried:

string !=~/regex/

but this doesn't seem to work..

anyone have any ideas how to do this?

thanks!
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
David A. Black
Guest
Posts: n/a
 
      02-17-2009
Hi --

On Tue, 17 Feb 2009, Sergio Ruiz wrote:

> okay, for some reason, i am not getting this.. i am feeling very
> stupid..
>
> i am trying to find a case where the regex does NOT match..
>
> i have tried:
>
> string !=~/regex/
>
> but this doesn't seem to work..


string !~ /regex/


David

--
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.rubypal.com
Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2)

Ruby Training Atlanta! April 1-3, http://www.entp.com/training/atlanta09

 
Reply With Quote
 
 
 
 
Sergio Ruiz
Guest
Posts: n/a
 
      02-17-2009

>
> string !~ /regex/
>
>
> David


wow!

that totally worked!

thanks SO much!

i can't believe that was so hard to find!

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RCR: String#contain? and Array#contain? Roger Pack Ruby 3 09-28-2010 04:13 PM
Does string contain A, and if so, does a section of string contain B Jason Carlton Javascript 11 12-08-2009 06:07 PM
a regex that does not contain comma Sijo Kg Ruby 17 07-15-2009 05:24 PM
regex to match strings that don't contain any digits? Dave Perl Misc 8 08-10-2005 08:10 AM
Java regex can't match lengthy match? hiwa Java 0 01-29-2004 10:09 AM



Advertisments