Hello.
I've come across a bug that I think best describes itself.
public static void main(String args[])
{
String regExp = "([:digit:]{2}[ /]?){3}[ /]?[:digit:]{4}";
System.out.println( regExp );
RE ISKtPattern = new RE( regExp );
//This turns out to be malformed, it leaves the "14/".
System.out.println( ISKtPattern.subst( "Lorem 14/03/77 4229 ipsum",
"WOOHOO!!!" ) );
regExp = "([:digit:][:digit:][ /]?){3}[ /]?[:digit:]{4}";
System.out.println( regExp );
ISKtPattern = new RE( regExp );
//This, however, runs just fine!
System.out.println( ISKtPattern.subst( "Lorem 14/03/77 4229 ipsum",
"WOOHOO!!!" ) );
}
This will give you the output:
([:digit:]{2}[ /]?){3}[ /]?[:digit:]{4}
Lorem 14/WOOHOO!!! ipsum
([:digit:][:digit:][ /]?){3}[ /]?[:digit:]{4}
Lorem WOOHOO!!! ipsum
Shouldn't these two regular expressions yield the same result?
Kind regards,
Stefan.
--------------------------------------------
Stefan Freyr Stefansson
Software Developer
deCODE Genetics, Inc.
http://www.decode.com
Phone: (+354) 570 2854
GSM: (+354) 861 1718
Fax: (+354) 491 3782
<<Stefan Stefansson.vcf>>
BEGIN:VCARD
VERSION:2.1
N;ENCODING=QUOTED-PRINTABLE:;=01
REV:20001030T115142Z
END:VCARD