Regular expression – [0-9A-FA-F] is the same as [0-9A-F-A-F]?

Are these two equivalent? [0-9a-fA-F] and [0-9a-fAF]

In some texts, I have been trying to use egrep these two regular expressions, they seem to be equivalent .
Is there a case where they will not return the same result?

Also, in the second expression, what does the second expression mean-why do I need it? I am confused by these simple examples.

The second expression also matches dash and sixteen

Edit in egrep, this is the second one you are using is actually invalid:

# echo "12345678 "| egrep'^[0-9a-fAF]+$'
egrep: Invalid range end

The second correct expression ends with a dash:

[0-9a-fA-F-]

Are these two equivalent? [0-9a-fA-F] and [0-9a-fAF]

In some texts, I have been trying to use egrep these two regular expressions, they seem to be equivalent .
Is there a case where they will not return the same result?

Also, in the second expression, what does the second expression mean-why do I need it? I am confused by these simple examples.

The second expression also matches dash and hexadecimal

Edit in egrep, this is the second one you are using is actually invalid:

# echo "12345678" | egrep'^[0-9a-fAF] +$'
egrep: Invalid range end

The second correct expression ends with a dash:

[0-9a- fA-F-]

Leave a Comment

Your email address will not be published.