So, I have this string 90d_ASD_A98CAWd9A_WF8
, and I want to capture the \w
group of characters in it and remove them. \w
captures both uppercase and lowercase alphabetical characters and the underscore.
However, even though sed identifies the \w
group, it doesn't replace the \w
group characters in the string, even if I enable extended regexp using the -E
option.
If I execute this:
echo "90d_ASD_A98CAWd9A_WF8" | sed -E s/"[\w]+"//g
I get:
90d_ASD_A98CAWd9A_WF8
However, if I explicitly mention the range of the characters I want to remove in the regexp:
echo "90d_ASD_A98CAWd9A_WF8" | sed -E s/"[A-Za-z_]+"//g
I get exactly what I'm expecting: the string with all the uppercase and lowercase alphabets and underscores removed:
909898
Am I using the \w
group wrongly? What am I doing wrong?