DANIL10RUS <danilleontevkek2...@gmail.com> writes:
>  danil@archlinux ~/minecraft_server> ls purpur-*.jar | grep -i "[^a-z\-\.]"
> purpur-2416.jar
> danil@archlinux ~/minecraft_server> ls purpur-*.jar | grep -i "[^a-z\.\-]"
> purpur-2416.jar

> Hello, encountered a RegEx error. For some reason grep doesn't recognize
> the “-” in \-\. but if we do \.\- it will work. Why is that?

Remember that within [...], backslash is not special but - is.  So in

   [^a-z\-\.]

The class specifies (1) the range from a to z, (2) the range from / to
/, (3) the character ..  Actually, it specifies the *complement* of that
set, so grep will give you any lines that contain a character that is
not in that set.

What is it you are trying to accomplish?

Dale



Reply via email to