てきとうなメモ

本の感想とか技術メモとか

Perlの正規表現のグルーピング

$ perldoc perlhist
...
           Perl 1 introduced Perl to the world, and changed /\(...\|...\)/ to
               /(...|...)/.  \(Dan Faigin still hasn't forgiven me. :−\)

となっていて、Perl version 0の頃はsed形式だったんだなと。

変えた理由は想像がつくけど、一応調べてみると

It turns out that you use the metacharacters much more frequently than you do the literal characters, so it made sense to change Perl so that /(.*)/ defined a substring that could be referenced later, while /\(.*\)/ matched a sequence inside literal parentheses.

その通りだなあ。

ちなみにDan FaiginがLarry Wallを許さないのは、Danのスクリプトをこの変更で全部ダメにしてしまったからとのこと

This change broke all of Dan Faigin’s scripts. I think he’s forgiven me by now, even if he won’t admit it.