Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!iWarp.intel.com!news From: merlyn@iWarp.intel.com (Randal L. Schwartz) Newsgroups: comp.lang.perl Subject: Re: regular expressions Message-ID: <1991Jun4.213051.5097@iWarp.intel.com> Date: 4 Jun 91 21:30:51 GMT References: <1991Jun4.175023.6509@serval.net.wsu.edu> Sender: news@iWarp.intel.com Reply-To: merlyn@iWarp.intel.com (Randal L. Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 21 In-Reply-To: hakimian@tek4.eecs.wsu.edu (Karl Hakimian - staff) Nntp-Posting-Host: se.iwarp.intel.com In article <1991Jun4.175023.6509@serval.net.wsu.edu>, hakimian@tek4 (Karl Hakimian - staff) writes: | For example, how would you write a regular expression that accepts a string | with "foo" iff "bar" is not also in the string. There's no trivial way to do it, unless you count if (/foo/ && !/bar/) { # yes! } else { # no (sigh) } as your (literal) solution. Regexs have a hard time saying "not this thing here", unless the "thing" is a single character. print "Just another Perl hacker," unless /foo/ && !/bar/ -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/