lib/rubocop/cop/mixin/regexp_metacharacter.rb in rubocop-performance-1.13.3 vs lib/rubocop/cop/mixin/regexp_metacharacter.rb in rubocop-performance-1.14.0
- old
+ new
@@ -52,12 +52,12 @@
/\A(?:#{Util::LITERAL_REGEX})+\$\z/o.match?(regex_str)
end
def drop_start_metacharacter(regexp_string)
if regexp_string.start_with?('\\A')
- regexp_string[2..-1] # drop `\A` anchor
+ regexp_string[2..] # drop `\A` anchor
else
- regexp_string[1..-1] # drop `^` anchor
+ regexp_string[1..] # drop `^` anchor
end
end
def drop_end_metacharacter(regexp_string)
if regexp_string.end_with?('\\z')