pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #8605: Regular expression lazy quantification issue
2+ messages / 2 participants
[nested] [flat]
* BUG #8605: Regular expression lazy quantification issue
@ 2013-11-19 10:56 atoriwork@gmail.com
2013-11-19 17:52 ` Re: BUG #8605: Regular expression lazy quantification issue Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: atoriwork@gmail.com @ 2013-11-19 10:56 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 8605
Logged by: Atori
Email address: atoriwork@gmail.com
PostgreSQL version: 9.2.4
Operating system: Debian 4.7.2-5, 64-bit
Description:
Lazy quantificators does't work after "or" block in regexp mask
('(a)|(b)'):
example:
string: 'CsssQsDpppppQsDpppQ'
mask: '((a)|(C.+?Q))s(D.+?Q)'
select regexp_replace('CsssQsDpppppQsDpppQ', '((C.+?Q))s(D.+?Q)', '#foo#');
result: "#foo#sDpppQ"
select regexp_replace('CsssQsDpppppQsDpppQ', '((a)|(C.+?Q))s(D.+?Q)',
'#foo#');
result: "#foo#"
expected result: "#foo#sDpppQ"
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #8605: Regular expression lazy quantification issue
2013-11-19 10:56 BUG #8605: Regular expression lazy quantification issue atoriwork@gmail.com
@ 2013-11-19 17:52 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2013-11-19 17:52 UTC (permalink / raw)
To: atoriwork@gmail.com; +Cc: pgsql-bugs
atoriwork@gmail.com writes:
> Lazy quantificators does't work after "or" block in regexp mask
> ('(a)|(b)'):
This isn't a bug, it's documented behavior. See
http://www.postgresql.org/docs/9.2/static/functions-matching.html#POSIX-MATCHING-RULES
specifically the bit that an RE containing an | operator is always greedy.
The non-greedy operators within it are constrained to match as little
as possible, but that happens after determining the overall match, which
will be greedy.
I realize that this might not be the behavior you'd like, but we're
unlikely to change it.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2013-11-19 17:52 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-11-19 10:56 BUG #8605: Regular expression lazy quantification issue atoriwork@gmail.com
2013-11-19 17:52 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox