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 Ed Chidester <ec...@textwise.com> on 2000/10/18 17:41:20 UTC

BUG -- backslashing bug example


I see in the BUGS document it is noted

   "It is possible that Perl5Util may not handle backslashing properly
    for certain rare cases.  Need to collect bug reports on this count
    and fix it if this is true."

Here is such an example. 
(I didn't see Jakarta-ORO on BugRatReport, so this is only posted here)

The following switch regular expression works in perl (both 5.00502 and 5.6.0)
but not using Perl5Util::substitute (in either Java 1.1.7 or 1.3):

    s/((?:[^\\#]*(?:\\#)?)+[^\\#]*).*$/$1/mg

    ( 
      This deviation -without backslashes- works fine in Java 
          s/((?:[^#]*(?:##)?)+[^#]*).*$/$1/mg
    )

I am attaching a simple (but slightly long) java program that illustrates the
bug. Its output is as follows:

------------------------------------------------------------------------------
Substitution failed
        sampleString =
# This is a sample input file # with some interesting things
This line should appear when parsed
This line should partially # appear when parsed
# This line should not appear at all when parsed
######Neither should this line
  # nor this line, but the spaces will appear
Will the spaces be removed? # Only time will tell
This line should appear "\#" in its entirety


Everything worked for test 2
------------------------------------------------------------------------------


Thanks for your time

Ed.

// Edward Chidester
// Software Engineer                            MNIS - Textwise Labs
// (315) 426-9311 x232                          401 South Salina Street
// echid@textwise.com                           Syracuse, NY 13202