Path: utzoo!attcan!uunet!nih-csl!lhc!mimsy!midway!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!cs.utexas.edu!sun-barr!ccut!wnoc-tyo-news!sragwa!sran124!sran230!sran84!sran84.sra.co.jp!utashiro From: utashiro@sran84.sra.co.jp (Kazumasa Utashiro) Newsgroups: comp.lang.perl Subject: strange regexp match Message-ID: <224@sran84.sra.co.jp> Date: 28 Sep 90 05:19:14 GMT Sender: utashiro@sran84.sra.co.jp Reply-To: utashiro@sra.co.jp Organization: Software Research Associates, Inc., Japan Lines: 35 I have a strange regexp match behavior. Try this script. ------------------------------------------------------------ #!/usr/local/bin/perl $_="xx.o:\t U xxxxx"; case1: do m('^(.*):\t([0-9a-f ]{8}) (\w) (.*)'); $_="xx.o:\t00000000 T xxxxx"; case2: do m('^(.*):\t([0-9a-f ]{8}) (\w) (.*)'); case3: do m('^(.*.):\t([0-9a-f ]{8}) (\w) (.*)'); # ! case4: do m('^(.*):\t?([0-9a-f ]{8}) (\w) (.*)'); # ! sub m { printf "%d: ", ++$i; print /$_[0]/ ? $& : "not matched", "\n"; } __END__ ------------------------------------------------------------ I've got following result from perl@28 on some machines. 1: xx.o: U xxxxx 2: not matched 3: xx.o: 00000000 T xxxxx 4: xx.o: 00000000 T xxxxx Using + instead of * makes no difference. Am I missing something? --- K. Utashiro utashiro@sra.co.jp