Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: What's a Word Boundary? Message-ID: <11598@jpl-devvax.JPL.NASA.GOV> Date: 27 Feb 91 00:58:20 GMT References: <1991Feb26.183337.24976@holos0.uucp> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Distribution: usa Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 17 In article <1991Feb26.183337.24976@holos0.uucp> lbr@holos0.uucp (Len Reed) writes: : The manual speaks of, but does not define, a "word boundary" in : regular expressions. I presume that a word is \w+ and that a word : boundary will match at ^ and $ and at the edges of, but not : within, \w+ . That's more or less correct. \b matches between \w and \W (in either order), where the beginning and end of the string are considered to be bounded by \W. : I'm trying to match 6 digit strings, but I don't want to match a : six digit string that is part of a larger alphanumeric string. : The following seems to work. Is it in fact what I want? : /\b\d{6}\b/ Yes. Larry