0
votes

How to write a regex that captures the string without the quotes if present otherwise remains same.

For ex - 
If input contains double quotes, capture the string without quotes.
"HELLO WORLD" -> HELLO WORLD
If input doesn't contain double quotes, capture the same string.
HELLO WORLD -> HELLO WORLD