On 20/03/17 12:19 AM, Eric Engestrom wrote: > On Sunday, 2017-03-19 13:44:30 +0000, Jan Beich wrote: >> Vinson Lee <v...@freedesktop.org> writes: >> >>> - -e 's/[[[:space:]]]+-DNDEBUG\>//g' \ >>> - -e 's/[[[:space:]]]+-D_GNU_SOURCE\>//g' \ >>> - -e 's/[[[:space:]]]+-pedantic\>//g' \ >>> + -e 's/[[[:space:]]]+-DNDEBUG[[[:space:]]]//g' \ >>> + -e 's/[[[:space:]]]+-D_GNU_SOURCE[[[:space:]]]//g' \ >>> + -e 's/[[[:space:]]]+-pedantic[[[:space:]]]//g' \ >> >> If you always expect whitespace on both sides but trim it the RE >> may not match with more than one occurence in sequence e.g., >> >> $ echo ' -D_GNU_SOURCE -DNDEBUG ' | >> sed -E -e 's/[[:space:]]+-DNDEBUG[[:space:]]//g' \ >> -e 's/[[:space:]]+-D_GNU_SOURCE[[:space:]]//g' >> -D_GNU_SOURCE >> >> vs. (restore some whitespace) >> >> $ echo ' -D_GNU_SOURCE -DNDEBUG ' | >> sed -E -e 's/[[:space:]]+-DNDEBUG[[:space:]]/ /g' \ >> -e 's/[[:space:]]+-D_GNU_SOURCE[[:space:]]/ /g' >> > > Oh yes, very good point there! > My r-b now stands with this fix applied :) > > This will lead to a bunch of unnecessary whitespace in the middle, but > I'm not sure I'd recommend addressing this: > A simple 's/[[[:space:]]]+/ /g' at the end should trivially fix this, > [...]
Another option would be to match the trailing whitespace as a subexpression and add that back on the right hand side. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev