Menu

#121 StringUtil.Matches() returns wrong value

open
None
5
2010-12-01
2010-11-30
No

E.g.
String value = "X'101'";
value.matches("\\d+") - returns false

but translated C# code
ILOG.J2CsMapping.Util.StringUtil.Matches(value,"\\d*X") - returns true

Discussion

  • Evgeny Filatov

    Evgeny Filatov - 2010-11-30

    Sorry, I mean
    ILOG.J2CsMapping.Util.StringUtil.Matches(value,"\\d+") - returns true

     
  • Alexandre FAU

    Alexandre FAU - 2010-11-30

    Hi,
    The code behind matches is :
    Regex regex = new Regex(regexp);
    return regex.Match(input).Success;
    I know that Java and C# rexgex acts differently ...
    So what the options are ? :
    - leave as is and documents (...) limitations
    - re-implements in .NET the Java behavior ...

    @

     
  • Alexandre FAU

    Alexandre FAU - 2010-12-01
    • assigned_to: nobody --> alexandrefau
     
  • Alexandre FAU

    Alexandre FAU - 2010-12-01

    Well, I have an implementation in .NET of the java regex behavior (Pattern, matcher, ...).
    The result is what you expect with that new implementation (94 classes ...).
    I also have the unit test for that but some of them failed on hard case (8).

     

Log in to post a comment.