Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 48329 invoked from network); 21 Aug 2007 17:15:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Aug 2007 17:15:05 -0000 Received: (qmail 15261 invoked by uid 500); 21 Aug 2007 17:15:02 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 14976 invoked by uid 500); 21 Aug 2007 17:15:02 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 14967 invoked by uid 99); 21 Aug 2007 17:15:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Aug 2007 10:15:01 -0700 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [151.193.120.24] (HELO sglonmg02-out.sabre.com) (151.193.120.24) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Aug 2007 17:15:29 +0000 X-ExtLoop1: From 212.161.126.12 X-IronPort-AV: E=Sophos;i="4.19,290,1183330800"; d="scan'208";a="1082522278" Received: from unknown (HELO lmnukms04.lastminute.com) ([212.161.126.12]) by sglonmg02-out.sabre.com with ESMTP; 21 Aug 2007 18:14:32 +0100 Received: from lmnukmx06.corp.lastminute.com (unverified) by lmnukms04.lastminute.com (Content Technologies SMTPRS 4.3.17) with ESMTP id for ; Tue, 21 Aug 2007 18:16:34 +0100 Received: from LMNUKMXV02.corp.lastminute.com ([192.168.9.25]) by lmnukmx06.corp.lastminute.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 21 Aug 2007 17:35:02 +0100 Received: from 192.168.34.156 ([192.168.34.156]) by LMNUKMXV02.corp.lastminute.com ([192.168.9.26]) via Exchange Front-End Server webmail.lastminute.com ([192.168.7.111]) with Microsoft Exchange Server HTTP-DAV ; Tue, 21 Aug 2007 16:34:40 +0000 User-Agent: Microsoft-Entourage/11.2.5.060620 Date: Tue, 21 Aug 2007 17:34:38 +0100 Subject: Re: Regex Help with Mod Rewrite From: Ross Heritage To: Message-ID: Thread-Topic: Regex Help with Mod Rewrite Thread-Index: AcfkESpiaQrFMlAEEdyaAgAWy56yTA== In-Reply-To: Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-OriginalArrivalTime: 21 Aug 2007 16:35:02.0881 (UTC) FILETIME=[3936AD10:01C7E411] X-Virus-Checked: Checked by ClamAV on apache.org Hi Soumya, Yep, for the future you probably want the user support list ( http://httpd.apache.org/lists.html#http-users). However, to be helpful I think the answers to your questions would be 1) Apache 1.3 uses POSIX based regular expressions, and apache 2.x uses the PCRE library, so they're perl compatible. 2) RewriteCond %{QUERY_STRING} (^|&|;)Operation=(((rain|spain|plain),)*(rain|spain|plain))($|&|;) RewriteRule . - [E=OPERATION:%2] There are lots of ways to optimise the above, but I've kept it to something relatively simple for easy reading... If you wanted anything more complicated than that in a single rule, I'd suggest looking at writing your own internal map function. This list could help you with that. HTH, Ross Heritage. On 21/8/07 17:04, "Soumya Sanyal" wrote: > Hello, > This might not be the most appropriate forum to field this question - but > I'm having serious issues with the formulation of a regex for Mod Rewrite. I > actually have a couple of questions to ask : > > 1> What is particular flavor of the regex engine being used by Mod Rewrite - > there are ever so slight variations in the different regex engines, e.g. > linux grep vs perl grep etc. > 2> I'm having trouble formulating a good compact regex to represent the > following problem : > > I want my RewriteCond to be conditioned on the %{QUERY_STRING} to contain > only the powerset of a group of words e.g. > > Hence if my set is say {rain,spain,plain} > > The RewriteCond should say yes to the following : > http://foo.bar.com/?Operation=rain,spain > http://foo.bar.com/?Operation=plain,rain,rain > http://foo.bar.com/?Operation=plain,rain,spain > > But not : > http://foo.bar.com/?Operation=rain,spain,mainly > > Help please ?