match - Boolean Result
suggest changeReturns true
or false
, which indicates whether the regexp is matched or not without updating $~
and other related variables. If the second parameter is present, it specifies the position in the string to begin the search.
/R.../.match?("Ruby") #=> true
/R.../.match?("Ruby", 1) #=> false
/P.../.match?("Ruby") #=> false
Ruby 2.4+
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents