Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: Bug with regular expressions? (ver 3 patch 44) Message-ID: <11671@jpl-devvax.JPL.NASA.GOV> Date: 4 Mar 91 21:16:50 GMT References: <16981@venera.isi.edu> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 16 In article <16981@venera.isi.edu> sondeen@venera.isi.edu (Jeff Sondeen) writes: : : The following works without the caret (^) specifying beginning of line; with : the caret, it doesn't match the input (which starts in column 1): : : program: perl -ne 'if (/^\w:/) { print; }' : on input: nope: : gives result: : expected result: nope: : hypothesis: the caret(^) specifying beginning of line is messing up the : regular expression matching Alternate hypothesis: \w matches a word character, not a word. Test by using \w+ instead. Larry