Loading...

oro-user@jakarta.apache.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Regex Works on Oro Test Applet but doesn't work in code using oro 2.08 Keast Ann Tue Apr 05 09:18:12 2005

I am using jarkarta-oro-2.0.8 to do some input validation.
 
I have a simple method: 
 
import org.apache.oro.text.perl.Perl5Util;

    public static boolean matchRegexp(String value, String regexp) {
        if (regexp == null || regexp.length() <= 0) {
            return false;
        }
 
        Perl5Util matcher = new Perl5Util();
        return matcher.match("/" + regexp + "/", value);
    }
 
And it works fine in all cases with the regexp = (\\d{0,2})(\\.)(\\d{0,4}) 
except for when
value = 0.11000000000000000055511151231257827021181583404541015625
 
I expected this value to fail because it's greater than 4 digits after the 
decimal point. But it actually passes!  
 
It works on the applet at: http://jakarta.apache.org/oro/demo.html ( using:  
(\d{0,2})(\.)(\d{0,4}) ) but it doesn't work in my code using 
jarkarta-oro-2.0.8.
 
Any ideas on why this is occuring?
 
Thanks,
Ann