Mega Code Archive
Categories
/
Ruby
/
String
The String class has the =~ method and the !~ operator
If =~ finds a match, it returns the offset position where the match starts in the string: color = "color colour" color =~ /colou?r/ # => 13