If =~ finds a match, it returns the offset position where the match starts in the string: color = "color colour" color =~ /colou?r/ # => 13