Style/RedundantRegexpCharacterClass is problematic under in specific case:
def escape(text)
text.gsub(/.[\b]/, '')
end
# Style/RedundantRegexpCharacterClass: Redundant single-element character class, [\b] can be replaced with \b..
but, \b [\b] behave differently.
https://docs.ruby-lang.org/en/2.7.0/Regexp.html#class-Regexp-label-Anchors
\b - Matches word boundaries when outside brackets; backspace (0x08) when inside brackets
Ignore [\b] case.
Change [\b] to \b.
$ [bundle exec] rubocop -V
0.86.0 (using Parser 2.7.1.4, rubocop-ast 0.0.3, running on ruby 2.7.1 x86_64-darwin18)
@owst Can you take a look?
Aha, I missed this difference in behaviour, apologies - I'll have a look this evening UK time 馃憤
thx!
Most helpful comment
Aha, I missed this difference in behaviour, apologies - I'll have a look this evening UK time 馃憤