I wanted to remove type hints from my Clojure source codes, so I tried:
echo "(def ^Integer a 1)" | egrep '\^\w+ '
And it successfully matches the type hint.
Next, I tried:
echo "(def ^Integer a 1)" | sed s/\^\w+//g
however sed does not replace the type hint with empty.
What is wrong with my regex?
You need to enclose the regex in
'and also escape the+: