jakarta-oro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 16461] New: - Broken non-greedy regular expressions.
Date Mon, 27 Jan 2003 16:53:56 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16461>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16461

Broken non-greedy regular expressions.

           Summary: Broken non-greedy regular expressions.
           Product: ORO
           Version: 2.0.6
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Main
        AssignedTo: oro-dev@jakarta.apache.org
        ReportedBy: alexeys@inventigo.com


The problem was found in Jython by several programmers, but it looks like ORO's
fault. I replaced Jython's ORO with ORO 2.0.7 - the result is the same.

 In the following test the first block matching
([^":]*?) contains quotas, but if expression is
([^":]*), it does not match at all. Greedy modifier
cannot affect operation success.

Test program:

import re

s='"file.name" "path/file"'
s2=re.sub(r'^"([^":]*)/([^":/\\]*)"', r'1 #\1#\n2#\2#', s)
s3=re.sub(r'^"([^":]*?)/([^":/\\]*)"', r'1 #\1#\n2#\2#', s)

print
"s='"+s+"'\n\n============================\ns2='"+s2+"'\n\n============================\ns3='"+s3+"'"


output (s2 is not changed - no match; s3's first block
contains quotas):

s='"file.name" "path/file"'

============================
s2='"file.name" "path/file"'

============================
s3='1 #file.name" "path#
2 #file#'

--
To unsubscribe, e-mail:   <mailto:oro-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:oro-dev-help@jakarta.apache.org>


Mime
View raw message