7 Replies Latest reply: Sep 16, 2013 7:45 AM by just a DBA RSS

    regex

    just a DBA

      I have a simple issue. I want to reuse a part of Pattern, but it doesn't work.

       

      String s = "A=2  B=5";

      System.out.println(s.matches( "\\S+=\\S+\\s+\\S+=\\S+"));   -- true, OK

      System.out.println(s.matches("(\\S+=\\S+)\\s+\\1"));        -- false

       

      Thanks for help.