Обсуждение: Extending Regular Expression bounds limit of 255.

Поиск
Список
Период
Сортировка

Extending Regular Expression bounds limit of 255.

От
Brent DeSpain
Дата:
In the docs <a
href="http://www.postgresql.org/docs/8.3/interactive/functions-matching.html#POSIX-EMBEDDED-OPTIONS-TABLE">http://www.postgresql.org/docs/8.3/interactive/functions-matching.html#POSIX-EMBEDDED-OPTIONS-TABLE</a><br
/>it says that Regular Expression bounds {m,n} that m and n can be 0-255.  Is there a way to extend the upper limit. 
Weare trying to be consistent between Regular Expressionimplementation an the other implementations do not have this
limit.<br/><br clear="all" />Brent DeSpain<br />Schweitzer Engineering Laboratories, Inc.<br /> 

Re: Extending Regular Expression bounds limit of 255.

От
Andrej
Дата:
On 28 May 2010 07:33, Brent DeSpain <bd.postgres@gmail.com> wrote:
> In the docs
> http://www.postgresql.org/docs/8.3/interactive/functions-matching.html#POSIX-EMBEDDED-OPTIONS-TABLE
> it says that Regular Expression bounds {m,n} that m and n can be 0-255.  Is
> there a way to extend the upper limit.  We are trying to be consistent
> between Regular Expressionimplementation an the other implementations do not
> have this limit.
Interesting.  The POSIX standard for REs dictates this limit; which
implementations
you're using don't adhere to it?


Cheers,
Andrej




--
Please don't top post, and don't use HTML e-Mail :}  Make your quotes concise.

http://www.american.edu/econ/notes/htmlmail.htm


Re: Extending Regular Expression bounds limit of 255.

От
Brent DeSpain
Дата:
No.  Strangely enough they don't in enforce this limit.

Brent DeSpain
Schweitzer Engineering Laboratories, Inc.


On Thu, May 27, 2010 at 2:59 PM, Andrej <andrej.groups@gmail.com> wrote:
On 28 May 2010 07:33, Brent DeSpain <bd.postgres@gmail.com> wrote:
> In the docs
> http://www.postgresql.org/docs/8.3/interactive/functions-matching.html#POSIX-EMBEDDED-OPTIONS-TABLE
> it says that Regular Expression bounds {m,n} that m and n can be 0-255.  Is
> there a way to extend the upper limit.  We are trying to be consistent
> between Regular Expressionimplementation an the other implementations do not
> have this limit.
Interesting.  The POSIX standard for REs dictates this limit; which
implementations
you're using don't adhere to it?


Cheers,
Andrej




--
Please don't top post, and don't use HTML e-Mail :}  Make your quotes concise.

http://www.american.edu/econ/notes/htmlmail.htm

Re: Extending Regular Expression bounds limit of 255.

От
Brent DeSpain
Дата:
It looks like most of our tools are using the Perl version of regular expressions with an upper limit of a bound being 32766.  Is there any way to change this in PG?  Or can I change from POSIX to Perl?

Brent DeSpain
Schweitzer Engineering Laboratories, Inc.


On Thu, May 27, 2010 at 4:44 PM, Brent DeSpain <bd.postgres@gmail.com> wrote:
No.  Strangely enough they don't in enforce this limit.


Brent DeSpain
Schweitzer Engineering Laboratories, Inc.


On Thu, May 27, 2010 at 2:59 PM, Andrej <andrej.groups@gmail.com> wrote:
On 28 May 2010 07:33, Brent DeSpain <bd.postgres@gmail.com> wrote:
> In the docs
> http://www.postgresql.org/docs/8.3/interactive/functions-matching.html#POSIX-EMBEDDED-OPTIONS-TABLE
> it says that Regular Expression bounds {m,n} that m and n can be 0-255.  Is
> there a way to extend the upper limit.  We are trying to be consistent
> between Regular Expressionimplementation an the other implementations do not
> have this limit.
Interesting.  The POSIX standard for REs dictates this limit; which
implementations
you're using don't adhere to it?


Cheers,
Andrej




--
Please don't top post, and don't use HTML e-Mail :}  Make your quotes concise.

http://www.american.edu/econ/notes/htmlmail.htm


Re: Extending Regular Expression bounds limit of 255.

От
alvherre
Дата:
Excerpts from Brent DeSpain's message of jue may 27 18:55:55 -0400 2010:
> It looks like most of our tools are using the Perl version of regular
> expressions with an upper limit of a bound being 32766.  Is there any way to
> change this in PG?  Or can I change from POSIX to Perl?

See regcomp.c; you'll have to recompile.  The interesting constant is
DUPMAX (defined in regguts.h as per POSIX), but note that there's
arithmetic in repeat() with those values.  I wouldn't recommend doing
any of this unless you have time to figure out whether the algorithms
are efficient for larger values though.

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: Extending Regular Expression bounds limit of 255.

От
Brent DeSpain
Дата:
Yep.  That is what I was looking at this morning.  It is probably too late in this release of our project to make this change.

Thanks for the help.

Brent DeSpain
Schweitzer Engineering Laboratories, Inc.


On Fri, May 28, 2010 at 9:14 AM, alvherre <alvherre@commandprompt.com> wrote:
Excerpts from Brent DeSpain's message of jue may 27 18:55:55 -0400 2010:
> It looks like most of our tools are using the Perl version of regular
> expressions with an upper limit of a bound being 32766.  Is there any way to
> change this in PG?  Or can I change from POSIX to Perl?

See regcomp.c; you'll have to recompile.  The interesting constant is
DUPMAX (defined in regguts.h as per POSIX), but note that there's
arithmetic in repeat() with those values.  I wouldn't recommend doing
any of this unless you have time to figure out whether the algorithms
are efficient for larger values though.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: Extending Regular Expression bounds limit of 255.

От
Jasen Betts
Дата:
On 2010-05-27, Brent DeSpain <bd.postgres@gmail.com> wrote:
> --00504502c13812967604879b4ba3
> Content-Type: text/plain; charset=ISO-8859-1
>
> It looks like most of our tools are using the Perl version of regular
> expressions with an upper limit of a bound being 32766.  Is there any way to
> change this in PG?  Or can I change from POSIX to Perl?

perhaps you can do something in pl-perl?

posix regular expressions are different to perl regular expressions in
several ways.



Re: Extending Regular Expression bounds limit of 255.

От
Tim Landscheidt
Дата:
Jasen Betts <jasen@xnet.co.nz> wrote:

>> It looks like most of our tools are using the Perl version of regular
>> expressions with an upper limit of a bound being 32766.  Is there any way to
>> change this in PG?  Or can I change from POSIX to Perl?

> perhaps you can do something in pl-perl?

> posix regular expressions are different to perl regular expressions in
> several ways.

Another last resort possibility would of course be to "pre-
compile" the regular expressions from "A{2000}" to
"A{255}A{255}A{255}A{255}A{255}A{255}A{255}A{215}" (with the
headaches of "A{1000,2000}" left as an exercise to the read-
er :-)).

Tim



Re: Extending Regular Expression bounds limit of 255.

От
Jasen Betts
Дата:
On 2010-05-29, Tim Landscheidt <tim@tim-landscheidt.de> wrote:
> Jasen Betts <jasen@xnet.co.nz> wrote:
>
>>> It looks like most of our tools are using the Perl version of regular
>>> expressions with an upper limit of a bound being 32766.  Is there any way to
>>> change this in PG?  Or can I change from POSIX to Perl?
>
>> perhaps you can do something in pl-perl?
>
>> posix regular expressions are different to perl regular expressions in
>> several ways.
>
> Another last resort possibility would of course be to "pre-
> compile" the regular expressions from "A{2000}" to
> "A{255}A{255}A{255}A{255}A{255}A{255}A{255}A{215}" 
(A{200}){10}might work better.

> (with the headaches of "A{1000,2000}" left as an exercise to the read-
> er :-)).

easy enoungh to write, but probably easy to write an expression with
factorial complexity too, but this one should work, having at worst
two ways of matching any string.
(A{200}){5,9}A{0,200} 

but 
(A{5,10}){200}
is asking for trouble.