class Regexp
Public Instance Methods
match!(str, pos = 0)
click to toggle source
Like {docs.ruby-lang.org/en/master/Regexp.html#method-i-match +Regexp#match+}, but raises an exception if the match fails.
@example
/^([^@]+)@(.+)$/.match!("user@example.com") # === MatchData /^([^@]+)@(.+)$/.match!("@user") # raises exception
@param str [String]
String to search
@param pos [Integer]
Position in +str+ to search from
@return [MatchData] @raise [MiniSanity::Error]
if the Regexp does not match +str+
# File lib/mini_sanity/match.rb, line 53 def match!(str, pos = 0) str.match!(self, pos) end