You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-dev@jakarta.apache.org by bu...@apache.org on 2003/01/27 17:53:56 UTC
DO NOT REPLY [Bug 16461] New: -
Broken non-greedy regular expressions.
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>