Bug 22966 - off by two error in RE.subst
Summary: off by two error in RE.subst
Status: CLOSED DUPLICATE of bug 22928
Alias: None
Product: Regexp
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: Macintosh All
: P3 critical (vote)
Target Milestone: ---
Assignee: Jakarta Notifications Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-07 14:40 UTC by Jakob Schlyter
Modified: 2005-03-20 17:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakob Schlyter 2003-09-07 14:40:33 UTC
the following trivial test program triggers a bug in RE.subst:

import org.apache.regexp.*;
import java.io.*; 
import java.text.*; 
import java.util.*; 
public class test
{ 
    public static void main(String[] args)
    {
	RE regexp = new RE("http://(.*)/(.*)");
	String test = "http://www.apache.org/test";
	System.out.println(regexp.subst(test, "host: $1",
					RE.REPLACE_BACKREFERENCES));
	System.out.println(regexp.subst(test, "dir: $2",
					RE.REPLACE_BACKREFERENCES));
    }
}

outputs:

st: www.apache.org
r: test

instead of:

host: www.apache.org
dir: test
Comment 1 Vadim Gritsenko 2003-09-07 15:02:50 UTC
Duplicate

*** This bug has been marked as a duplicate of 22928 ***