On Sun, Aug 09, 2015 at 01:06:30AM +0200, Aymeric Vincent wrote: > David Holland <dholland-sourcechan...@netbsd.org> writes: > > > > Fix bracket expressions by moving '-' to the end of them. GNU awk > > choked. > > > > Front is safer. fwiw. > > OK, I moved them to the front, together with '_' because it felt awkward > to separate the separators. Out of curiosity, is it "safer" just because > it is more robust to future additions to the expression or is it > actually "safer" even if the expression is left as is?
It's safer in the sense that a broken regexp parser is unlikely to accidentally treat the first character of a character set as the middle - in a range; but if the last character is - it might interpret the second-last character, the -, and closing ] as a range, with unfortunate results. It is not very likely; but stranger things have happened, and it doesn't help that regexp tools have a long-standing culture of not complaining about invalid regexp syntax. anyway it's a very minor point. -- David A. Holland dholl...@netbsd.org