RPM Community Forums

Mailing List Message of <rpm-devel>

Re: Is there an implementation for PCRE <-> POSIX interconversion?

From: R P Herrold <herrold@owlriver.com>
Date: Sat 19 Apr 2008 - 18:08:57 CEST
Message-ID: <alpine.LRH.1.10.0804191147430.8276@arj.bjyevire.pbz>
On Sat, 19 Apr 2008, Jeff Johnson wrote:

> A little reading indicates that I have inadvertently worded 
> my question re a PCRE <-> POSIX conversion "implementation" 
> incorrectly.
  ...
> I was hoping that the _SYNTAX_ can be interconverted for a 
> significant subset of all possible PCRE <-> POSIX 
> expressions. I'm perfectly willing to try a imperfect, known 
> flawed, interconversion of _SYNTAX_ if the patterns that are 
> typically needed by RPM can be mostly converted reliably.
>
> Note: "significant" and "typically needed". YMMV, as always.

I think this article encapsulates the issue I was noting in my 
IRC remarks yesterday, mentioning classical Unix, FSF, 
procmail <!>, and other varaints;
    http://en.wikipedia.org/wiki/Regular_expression

[ Perl has a more predictable and much richer syntax than the 
[ POSIX basic (BRE) and extended (ERE) regular expression 
[ standards.  ... other utilities ... have adopted syntax 
[ similar to Perl's — for example ...  PCRE ... [and others not 
[ listed each] use regular expression syntax similar to Perl's

That is, there has been a 'pick and choose' over time, and of 
course a series of 'improvements' and 'regularizations'

The implied requirement of a quest to find a prebuilt tool to 
automatically do all possible inverse transforms, from the 
initial use of the bare '<->', was probably doomed to 'no 
reply' -- The article notes that there is an incompatible 
even in the standard for simplest variation of POSIX 'basic' 
and 'extended' forms:

[ The meaning of metacharacters escaped with a backslash is 
[ reversed for some characters in the POSIX Extended Regular 
[ Expression (ERE) syntax

so absent an option switch, no 'perfect' inverset (',-.') set 
of transform can exist.  Move a few generations away into PRCE 
and ...

-- Russ herrold
Received on Sat Apr 19 18:08:59 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.