<img src="url.png" alt="alttext">.
(...) parts work fine, it's the
[...] part that I can't get to work.
As a simple example, I want to match the input
a [test] b. This is the command I use:
echo 'a [test] b' | sed 's/\[[^\]]*\]/x/'
It doesn't work. When I replace the square brackets with angle brackets, it works just fine:
echo 'a <test> b' | sed 's/<[^>]*>/x/'
Why does sed not understand the same regex but with escaped square brackets? It works fine in other tools such as Python.