This discussion is archived
7 Replies Latest reply: Sep 16, 2013 5:45 AM by just a DBA RSS

regex

just a DBA Newbie
Currently Being Moderated

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. 

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points