Hacker News new | ask | show | jobs
by hddqsb 1435 days ago
Obligatory example where the extra backslash makes a difference:

    $ printf '%s\n' 'asterisk: *' 'backslash: \' | grep '[*]'
    asterisk: *
    $ printf '%s\n' 'asterisk: *' 'backslash: \' | grep '[\*]'
    asterisk: *
    backslash: \
It depends on the regex flavour though (doesn't happen with Python, JavaScript, or Perl for example).