Closed IoLimmer closed 4 months ago
With grep, when you pass a pattern that starts with a hyphen, grep will misinterpret this as an option flag and throw an error. This doesn't seem to be accounted for on the site.
grep -P -i "-[A-Za-z0-9]+" test.txt
Seen here
When passed on the terminal with lscpu I get this error:
grep: invalid option -- '[' Usage: grep [OPTION]... PATTERNS [FILE]... Try 'grep --help' for more information.
Admittedly this can be fixed easily by adding a backslash infront of the hyphen but I thought it was worth mentioning.
Hi @IoLimmer , thank you for filing this. I can reproduce the issue and will add a fix for that.
With grep, when you pass a pattern that starts with a hyphen, grep will misinterpret this as an option flag and throw an error. This doesn't seem to be accounted for on the site.
grep -P -i "-[A-Za-z0-9]+" test.txt
Seen here
When passed on the terminal with lscpu I get this error:
Admittedly this can be fixed easily by adding a backslash infront of the hyphen but I thought it was worth mentioning.