Path: utzoo!attcan!uunet!decwrl!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: What I want in regular expressions Message-ID: <8513@jpl-devvax.JPL.NASA.GOV> Date: 27 Jun 90 17:31:43 GMT References: <1990Jun27.144859.15573@uvaarpa.Virginia.EDU> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 49 In article <1990Jun27.144859.15573@uvaarpa.Virginia.EDU> worley@compass.com writes: : There are a number of features that could be put into regexp matching : that would make life easier: : : a \- b : : Match any string which matches a but is not matched (in its entirity) : by b. : : \- b : : Match the null string if what follows this position is not matched by : b. : : a \: b \; c : : Match b but only if its left context is matched by a and its right : context is matched by c. This would be useful for simplifying s/ / / : constructions: : : s/(a)b(c)/\1d\2/ : : becomes : : s/a\:b\;c/d/ : : Probably, a should be included in $` and c in $'. : : How hard would this be to do? I don't think "hard" is the quite right question. I have three problems with this: 1) It's non-standard, so people won't think to use it. Hence it would tend to be excess baggage. 2) After scratching my head for some time, I can't think what all the ramifications of the first two constructs might be. And I think there are a certain number of people in the world who are more confusable than me. 3) I am opposed to backwhacking punctuation to make metacharacters, for readability and quotability reasons. But it would be nice to be able to do boolean lookahead. Someday I might make it possible to call subroutines within a pattern to allow this sort of semantics. It looks cleaner to me. Larry