strings
strings copied to clipboard
sanitize removes brackets that it should not
Describe the problem
When the ANSI sequence is directly wrapped in brackets the brackets are removed from the output.
Steps to reproduce the problem
require 'strings-ansi'
str1 = "[\e[1;34mINFO\e[m] Scanning for projects..."
str2 = "[ \e[1;34mINFO\e[m ] Scanning for projects..."
puts str1
puts str2
puts Strings::ANSI.sanitize(str1)
puts Strings::ANSI.sanitize(str2)
Actual behaviour
[INFO] Scanning for projects...
[ INFO ] Scanning for projects...
INFO Scanning for projects...
[ INFO ] Scanning for projects...
Expected behaviour
[INFO] Scanning for projects...
[ INFO ] Scanning for projects...
[INFO] Scanning for projects...
[ INFO ] Scanning for projects...
Describe your environment
- OS version: Linux (Fedora 38)
- Ruby version: 3.1.4
- strings (0.2.1)
- strings-ansi (0.2.0)