Path: utzoo!attcan!uunet!cs.utexas.edu!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: getting closer Message-ID: <8501@jpl-devvax.JPL.NASA.GOV> Date: 26 Jun 90 23:14:10 GMT References: Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 18 In article vixie@decwrl.dec.com (Paul A Vixie) writes: : [vixie:vax] perl : /[\+\dx]/; : /[\+\-\dx]/; : /[\+\-\dx]/: invalid [] range in regexp at - line 2. : [vixie:vax] : : Why can't I use \- in a character class to get a literal "-" ?? Because people typically do it the Unix Way and put the - in front or back. I could make it work with backslash, and it might even be reasonable, just to maintain the principle of least surprise. On the other hand, backslash-itis is something I try to avoid when possible. Which is why I went with the egrep notion of (|){} as metacharacters rather than \(\|\)\{\}, since the metacharacters actually occur rather more frequently than the literal counterparts. Larry