regex - PatternSyntaxException: while using String.ReplaceAll function in java? -


When I'm trying to do a string, I get a patterninetex exception. ReplaceAll

Below is my string

  Number of testcases: 39? Test case execution: testCreateDAta? Class has completed its performance: test.com.myspace.service.ejb.session.MyTest? Execution of test case ended: testCreateDAta? Test case execution: testUpdate?   

What I was trying to do:

  junitReportString.replaceAll ("?", "\ N");   

The above code brought me an exception to:

  java.util.regex.PatternSyntaxException: Dangling meta character '?' After this I tried again with the code below:  
  junitReportString.replaceAll ("\\?", "\ N");   

The code above received me the same string as I mentioned above.

My complete code:

  string junitReportString = new string (); MyApp = New URL ("http: // localhost: port / testWeb / TestJunit.jsp"); URL connection yc = myApp.openConnection (); Yc.connect (); JunitReportString = yc.getHeaderField ("finalJUNITReport") toString (). Println (junitReportString); JunitReportString.replaceAll ("\\?", "\ N"); System.out.println ("Report Details ===============" + junitReportString);   

Any guidance what's wrong in my code is highly appreciated.

the actual string does not change the new string That includes changes.

  junitReportString = junitReportString.replaceAll ("\\?", "\ N"); // You have now changed the string    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -