Jakarta Regexp 1.5 Backreferences?

Posted by Matt Smith on Stack Overflow See other posts from Stack Overflow or by Matt Smith
Published on 2010-04-01T18:32:32Z Indexed on 2010/04/01 20:03 UTC
Read the original article Hit count: 266

Filed under:
|
|
|

Why does this match:

String str = "099.9 102.2" + (char) 0x0D;
RE re = new RE("^([0-9]{3}.[0-9]) ([0-9]{3}.[0-9])\r$");        
System.out.println(re.match(str));

But this does not:

String str = "099.9 102.2" + (char) 0x0D;   
RE re = new RE("^([0-9]{3}.[0-9]) \1\r$");      
System.out.println(re.match(str));

The back references don't seem to be working... What am I missing?

© Stack Overflow or respective owner

Related posts about java

Related posts about regex