Home
Ruby
ActiveRecord
Array
CGI
Class
Collections
Database
Date
Design Patterns
Development
File Directory
GUI
Hash
Language Basics
Method
Network
Number
Rails
Range
Reflection
Statement
String
Threads
Time
Tk
Unit Test
Windows Platform
XML
match « String « Ruby
Ruby
String
match
1.
use a method called match, provided by the String class
2.
match doesn't require a regular expression as an argument, it converts any string supplied into a regular expression
3.
if you surround a section with (), the data matched is made available separately from the rest.
4.
The String class has the =~ method and the !~ operator.
5.
The !~ operator returns true if it does not match the string, false otherwise:
6.
Pattern matching with regular expressions