title: JavaRegEx and complex long string
body: <p>I'm trying to extract the value from the exception by using regular expression in Java. But the string is too complicated and long (all in one line):</p>
  
  <blockquote>
    <p>ReturnCode={Val=9002;SubVal=9203;Text=Subscriber not found};Message=Subscriber not found;LocalizedMessage=Subscriber not found;Cause==null;StackTrace={[co.com.tigo.gatewaytigo.scp.mcommerce.method.RechargeMCommerce.getRechargeResult(RechargeMCommerce.java:72)][co.com.tigo.gatewaytigo.scp.mcommerce.MCommerceAPI.recharge(MCommerceAPI.java:353)][co.com.tigo.gatewaytigo.scp.interfacesscp.SCPFacade.recharge(SCPFacade.java:257)][co.com.tigo.gatewaytigo.webscp.ws.GatewayTigoWS.recharge(Unknown Source)][sun.reflect.GeneratedMethodAccessor4092.invoke(Unknown Source)][sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)][java.lang.reflect.Method.invoke(Method.java:597)][weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:89)][weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:71)][com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)][com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)][com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)][com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)][com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)][com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)][com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)][com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)][com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:444)][com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)][com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:134)][weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke.run(HttpServletAdapter.java:272)][weblogic.wsee.jaxws.HttpServletAdapter.post(HttpServletAdapter.java:185)][weblogic.wsee.jaxws.JAXWSServlet.doPost(JAXWSServlet.java:180)][javax.servlet.http.HttpServlet.service(HttpServlet.java:727)][weblogic.wsee.jaxws.JAXWSServlet.service(JAXWSServlet.java:64)][javax.servlet.http.HttpServlet.service(HttpServlet.java:820)][weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)][weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)][weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)][weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)][weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)][weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)][weblogic.security.service.SecurityManager.runAs(Unknown Source)][weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)][weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)][weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)][weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)][weblogic.work.ExecuteThread.run(ExecuteThread.java:173)]}</p>
  </blockquote>
  
  <p>I want to extract the Val and SubVal from that string and my pattern is:</p>
  
  <pre><code>^(?:(?:.|\\n|\\r)*)Val=(\\d+);SubVal=(\\d+)(?:(?:.)*)$
  </code></pre>
  
  <p>I got this exception:</p>
  
  <pre><code>Exception in thread "main" java.lang.StackOverflowError
      at java.lang.String.charAt(String.java:685)
      at java.lang.Character.codePointAt(Character.java:2335)
      at java.util.regex.Pattern$CharProperty.match(Pattern.java:3344)
      at java.util.regex.Pattern$Branch.match(Pattern.java:4114)
      at java.util.regex.Pattern$GroupHead.match(Pattern.java:4168)
      at java.util.regex.Pattern$Loop.match(Pattern.java:4295)
      at java.util.regex.Pattern$GroupTail.match(Pattern.java:4227)
      at java.util.regex.Pattern$BranchConn.match(Pattern.java:4078)
      at java.util.regex.Pattern$CharProperty.match(Pattern.java:3345)
      at java.util.regex.Pattern$Branch.match(Pattern.java:4114)
      at java.util.regex.Pattern$GroupHead.match(Pattern.java:4168)
      at java.util.regex.Pattern$Loop.match(Pattern.java:4295)
      at java.util.regex.Pattern$GroupTail.match(Pattern.java:4227)
  </code></pre>
  
  <p>How should I do to extract that Val and SubVal value from that string by using Java RegEx?</p>