Somewhere in there is a flag for using extended regular expressions with sed. That might work. Add it to the echo "$(echo ' M e ' | sed 's/^ *| *$//g')." command that didn't work to find out.
Because I was typing this command:
echo "$(echo ' M e ' | sed 's/^ *| *$//g' -E)."
But it turns out the lesson only accepts it if the flag is at the beginning of the command, like that:
echo "$(echo ' M e ' | sed -E 's/^ *| *$//g')."
Both commands give me the same output, but the first one doesn’t pass the tests, is this a bug?
That’s sort of a bug @lorenzo1lipp. Ideally, we would usually like to allow any valid syntax to work. If that’s valid, I think we would like to let it pass - although, many of these tests are quite difficult to write so it may not be worth it to try and include every single variation of valid syntax. I will take a look at improving that step. At a minimum, we should probably include the desired command in the hints.