0
System.out.println("<ChassisModuleOptionRequest partner_item='"'(.*)'"'>");


**Expected Output:**    <ChassisModuleOptionRequest partner_item="(.*)">

The above regex is not working, can someone please help me here.

Thanks,

Satish D

1
  • Try with \" instead of ' " ' Commented Aug 18, 2017 at 10:11

2 Answers 2

1

To escape " you should use \", but not '"'

System.out.println("<ChassisModuleOptionRequest partner_item=\"(.*)\">");
Sign up to request clarification or add additional context in comments.

1 Comment

if i use the above regex the output will be <ChassisModuleOptionRequest partner_item=(.*)> But am expecting an output like <ChassisModuleOptionRequest partner_item="(.*)">
0

Why not to try like this?

String source_string = "<ChassisModuleOptionRequest partner_item='\"'(.*)'\"'>";
String target_string = str.replaceAll("'", "");
System.out.println(target_string);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.