Is there a way on IntelliJ to remove surrounding parenthesis, brackets, quotes, etc? For example, if I have:
"string"
Is there any way to remove the matching quotes and get this?
string
Not directly, but the following replace expression (ctrl+R, tick Regex
) might help:
Search for: "(.*)"
replace with: $1
Edit: I found an easier way (plugin code with regex left below for nostalgia)
Webstorm has extend selection and shrink selection on mac they are bound to alt-upArrow and alt-downArrow
You can use extend selection to select the content and the quotes/braces/parens, then record a macro (i called mine unwrap) and perform the following actions:
then you can save the macro and add a key binding.
Any time you want to unwrap something, you can just extend the selection until it includes the outer braces, then hit your hotkey and it will replace the selection including the braces with their inner contents.
I made a mini-plugin,
which i install/code using live-plugin.
It relies on this Regex:
[\["'({](.+)['"})\]]
The Regex will also often work in the Search/Replace function in webstorm
(with Regex and In Selection checked), but it fails in mysterious cases:
IDEA have an action to go to matching brace.
You can create macro with something like: goto next brace - delete one char - goto prev brace - delete one more char.
And then set kb shortcut to this macro.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With