How to use start and end restrictions in WebStorm search (and other JetBrains IDEs)?












1















I want to create a regex that will "unwrap" code that is quoted, in parentheses, brackets, or braces.



I have a regex that should work:



^["'({(.+)["')}]]$


The ^ and $ are important to prevent inner characters from breaking the match.



In WebStorm (2018.1.6) The regex works without the ^ and $:



["'({(.+)["')}]]


Working RegEx



but fails if I add the start and end restriction:



^["'({(.+)["')}]]$


enter image description here



Is there a trick to do this? Is it a problem with combining "Regex" and "In Selection" modes for Search/Replace? Could it be a bug?



Any help?










share|improve this question




















  • 1





    The ^ and $ in your current regex doesn't make any sense unless the match will necessarily match the entire line - they're start-of-line and end-of-line anchors. Try pasting in your real code instead: regex101.com/r/tEwrmM/2 (note that most of those characters in the character set don't actually need to be escaped)

    – CertainPerformance
    Nov 25 '18 at 22:21






  • 1





    You can't use '^' and ''$' since you are only matching part of the line (in the images)! There are characters before and after the match, that will make full line fail.

    – Poul Bak
    Nov 25 '18 at 22:48













  • @PoulBak, thats what i meant by 'problem with combining "Regex" and "In Selection" modes'... I guess I expected that if I have "In Selection" checked that it will consider the beginning and end of the selection as the 'start-of-line and end-of-line'

    – gotjosh
    Nov 25 '18 at 23:15











  • @CertainPerformance, thanks for the hint that i was over-escaping and for the fix on regex101

    – gotjosh
    Nov 26 '18 at 9:39
















1















I want to create a regex that will "unwrap" code that is quoted, in parentheses, brackets, or braces.



I have a regex that should work:



^["'({(.+)["')}]]$


The ^ and $ are important to prevent inner characters from breaking the match.



In WebStorm (2018.1.6) The regex works without the ^ and $:



["'({(.+)["')}]]


Working RegEx



but fails if I add the start and end restriction:



^["'({(.+)["')}]]$


enter image description here



Is there a trick to do this? Is it a problem with combining "Regex" and "In Selection" modes for Search/Replace? Could it be a bug?



Any help?










share|improve this question




















  • 1





    The ^ and $ in your current regex doesn't make any sense unless the match will necessarily match the entire line - they're start-of-line and end-of-line anchors. Try pasting in your real code instead: regex101.com/r/tEwrmM/2 (note that most of those characters in the character set don't actually need to be escaped)

    – CertainPerformance
    Nov 25 '18 at 22:21






  • 1





    You can't use '^' and ''$' since you are only matching part of the line (in the images)! There are characters before and after the match, that will make full line fail.

    – Poul Bak
    Nov 25 '18 at 22:48













  • @PoulBak, thats what i meant by 'problem with combining "Regex" and "In Selection" modes'... I guess I expected that if I have "In Selection" checked that it will consider the beginning and end of the selection as the 'start-of-line and end-of-line'

    – gotjosh
    Nov 25 '18 at 23:15











  • @CertainPerformance, thanks for the hint that i was over-escaping and for the fix on regex101

    – gotjosh
    Nov 26 '18 at 9:39














1












1








1








I want to create a regex that will "unwrap" code that is quoted, in parentheses, brackets, or braces.



I have a regex that should work:



^["'({(.+)["')}]]$


The ^ and $ are important to prevent inner characters from breaking the match.



In WebStorm (2018.1.6) The regex works without the ^ and $:



["'({(.+)["')}]]


Working RegEx



but fails if I add the start and end restriction:



^["'({(.+)["')}]]$


enter image description here



Is there a trick to do this? Is it a problem with combining "Regex" and "In Selection" modes for Search/Replace? Could it be a bug?



Any help?










share|improve this question
















I want to create a regex that will "unwrap" code that is quoted, in parentheses, brackets, or braces.



I have a regex that should work:



^["'({(.+)["')}]]$


The ^ and $ are important to prevent inner characters from breaking the match.



In WebStorm (2018.1.6) The regex works without the ^ and $:



["'({(.+)["')}]]


Working RegEx



but fails if I add the start and end restriction:



^["'({(.+)["')}]]$


enter image description here



Is there a trick to do this? Is it a problem with combining "Regex" and "In Selection" modes for Search/Replace? Could it be a bug?



Any help?







regex webstorm jetbrains






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 0:52









LazyOne

109k21244266




109k21244266










asked Nov 25 '18 at 22:17









gotjoshgotjosh

31728




31728








  • 1





    The ^ and $ in your current regex doesn't make any sense unless the match will necessarily match the entire line - they're start-of-line and end-of-line anchors. Try pasting in your real code instead: regex101.com/r/tEwrmM/2 (note that most of those characters in the character set don't actually need to be escaped)

    – CertainPerformance
    Nov 25 '18 at 22:21






  • 1





    You can't use '^' and ''$' since you are only matching part of the line (in the images)! There are characters before and after the match, that will make full line fail.

    – Poul Bak
    Nov 25 '18 at 22:48













  • @PoulBak, thats what i meant by 'problem with combining "Regex" and "In Selection" modes'... I guess I expected that if I have "In Selection" checked that it will consider the beginning and end of the selection as the 'start-of-line and end-of-line'

    – gotjosh
    Nov 25 '18 at 23:15











  • @CertainPerformance, thanks for the hint that i was over-escaping and for the fix on regex101

    – gotjosh
    Nov 26 '18 at 9:39














  • 1





    The ^ and $ in your current regex doesn't make any sense unless the match will necessarily match the entire line - they're start-of-line and end-of-line anchors. Try pasting in your real code instead: regex101.com/r/tEwrmM/2 (note that most of those characters in the character set don't actually need to be escaped)

    – CertainPerformance
    Nov 25 '18 at 22:21






  • 1





    You can't use '^' and ''$' since you are only matching part of the line (in the images)! There are characters before and after the match, that will make full line fail.

    – Poul Bak
    Nov 25 '18 at 22:48













  • @PoulBak, thats what i meant by 'problem with combining "Regex" and "In Selection" modes'... I guess I expected that if I have "In Selection" checked that it will consider the beginning and end of the selection as the 'start-of-line and end-of-line'

    – gotjosh
    Nov 25 '18 at 23:15











  • @CertainPerformance, thanks for the hint that i was over-escaping and for the fix on regex101

    – gotjosh
    Nov 26 '18 at 9:39








1




1





The ^ and $ in your current regex doesn't make any sense unless the match will necessarily match the entire line - they're start-of-line and end-of-line anchors. Try pasting in your real code instead: regex101.com/r/tEwrmM/2 (note that most of those characters in the character set don't actually need to be escaped)

– CertainPerformance
Nov 25 '18 at 22:21





The ^ and $ in your current regex doesn't make any sense unless the match will necessarily match the entire line - they're start-of-line and end-of-line anchors. Try pasting in your real code instead: regex101.com/r/tEwrmM/2 (note that most of those characters in the character set don't actually need to be escaped)

– CertainPerformance
Nov 25 '18 at 22:21




1




1





You can't use '^' and ''$' since you are only matching part of the line (in the images)! There are characters before and after the match, that will make full line fail.

– Poul Bak
Nov 25 '18 at 22:48







You can't use '^' and ''$' since you are only matching part of the line (in the images)! There are characters before and after the match, that will make full line fail.

– Poul Bak
Nov 25 '18 at 22:48















@PoulBak, thats what i meant by 'problem with combining "Regex" and "In Selection" modes'... I guess I expected that if I have "In Selection" checked that it will consider the beginning and end of the selection as the 'start-of-line and end-of-line'

– gotjosh
Nov 25 '18 at 23:15





@PoulBak, thats what i meant by 'problem with combining "Regex" and "In Selection" modes'... I guess I expected that if I have "In Selection" checked that it will consider the beginning and end of the selection as the 'start-of-line and end-of-line'

– gotjosh
Nov 25 '18 at 23:15













@CertainPerformance, thanks for the hint that i was over-escaping and for the fix on regex101

– gotjosh
Nov 26 '18 at 9:39





@CertainPerformance, thanks for the hint that i was over-escaping and for the fix on regex101

– gotjosh
Nov 26 '18 at 9:39












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53472557%2fhow-to-use-start-and-end-restrictions-in-webstorm-search-and-other-jetbrains-id%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53472557%2fhow-to-use-start-and-end-restrictions-in-webstorm-search-and-other-jetbrains-id%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin