detect: Prevent wrong parsing of dmesg

Let's only remove [] if it's for the first word. We do check then if
words remains before searching for items in dmesg.