In the program below I match an open XML tag and try
to use a backreference to match the corresponding
close tag, however it is not working.  The backreference
is causing it to fail.  If I replace it with "...." the
RE matches.  I am using Jakarata 2.0.6.

The backreference works in my Perl version (included below)
of this test.

Any suggestions?

Mark



import org.apache.oro.text.regex.*;
import org.apache.oro.text.perl.*;

public class OROTest {
        public static void main(String[] args)
        {
                Perl5Util perl = new Perl5Util();
                String input_data = "<B630>foo</B630>";
                String found_tag;

                System.out.println("looking...");
                if (perl.match("m|<(B6.*?)>.*</\1>|", input_data)) {
                        found_tag = perl.group(1);
                        System.out.println("matched tag: " + found_tag);
                }
        }
}


#!/usr/perl5/bin/perl
$input_data = "<B630>foo</B630>";
print "looking...\n";
if ($input_data =~ m|<(B6.*?)>.*</\1>|) {
        print "matched tag: $1\n";
}

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to