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 What I was trying to do: The above code brought me an exception to: The code above received me the same string as I mentioned above. My complete code: Any guidance what's wrong in my code is highly appreciated. the actual
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?
junitReportString.replaceAll ("?", "\ N");
java.util.regex.PatternSyntaxException: Dangling meta character '?' After this I tried again with the code below:
junitReportString.replaceAll ("\\?", "\ N");
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);
string does not change the new
string That includes changes.
junitReportString = junitReportString.replaceAll ("\\?", "\ N"); // You have now changed the string
Comments
Post a Comment