How can i choose an exact character in a txt file?












0















I use Search and Replace software, I need to erase a "-" character in many txt files.
The "-" always appears between two numbers but the numbers are always different (f.e: 1234567-8 or 34569-0).
there are other "-" that appears in the txt file but between letters, not numbers.
if I use [0-9]-[0-9] it chooses the "-" but erases the number before and after the "-" character.
is there a way to make the software to choose only the "-"I need?



questioner is fine with Notepad++ as text editor.










share|improve this question




















  • 1





    What text editor are you using, and are you willing to switch to a different one if yours does not support certain features?

    – LPChip
    Dec 24 '18 at 8:46











  • Without telling us which text editor you're using, your question will be closed as too broad (this is true despite the fact you have received an answer you like). Please do not respond in the comments. Instead, edit the post with this information.

    – Twisty Impersonator
    Dec 24 '18 at 11:48











  • @TwistyImpersonator judging by his answer, he's obviously fine with notepad++

    – barlop
    Dec 24 '18 at 12:01











  • @barlop I don't feel comfortable editing that into his question. It feels a bit like putting words in his mouth.

    – Twisty Impersonator
    Dec 24 '18 at 12:13













  • @TwistyImpersonator Well I just did. I could have done it as a note, it doesn't matter. I think it's preferable to the question being closed because which text editor wasn't mentioned when we know he's fine with a specific one.

    – barlop
    Dec 24 '18 at 13:42


















0















I use Search and Replace software, I need to erase a "-" character in many txt files.
The "-" always appears between two numbers but the numbers are always different (f.e: 1234567-8 or 34569-0).
there are other "-" that appears in the txt file but between letters, not numbers.
if I use [0-9]-[0-9] it chooses the "-" but erases the number before and after the "-" character.
is there a way to make the software to choose only the "-"I need?



questioner is fine with Notepad++ as text editor.










share|improve this question




















  • 1





    What text editor are you using, and are you willing to switch to a different one if yours does not support certain features?

    – LPChip
    Dec 24 '18 at 8:46











  • Without telling us which text editor you're using, your question will be closed as too broad (this is true despite the fact you have received an answer you like). Please do not respond in the comments. Instead, edit the post with this information.

    – Twisty Impersonator
    Dec 24 '18 at 11:48











  • @TwistyImpersonator judging by his answer, he's obviously fine with notepad++

    – barlop
    Dec 24 '18 at 12:01











  • @barlop I don't feel comfortable editing that into his question. It feels a bit like putting words in his mouth.

    – Twisty Impersonator
    Dec 24 '18 at 12:13













  • @TwistyImpersonator Well I just did. I could have done it as a note, it doesn't matter. I think it's preferable to the question being closed because which text editor wasn't mentioned when we know he's fine with a specific one.

    – barlop
    Dec 24 '18 at 13:42
















0












0








0








I use Search and Replace software, I need to erase a "-" character in many txt files.
The "-" always appears between two numbers but the numbers are always different (f.e: 1234567-8 or 34569-0).
there are other "-" that appears in the txt file but between letters, not numbers.
if I use [0-9]-[0-9] it chooses the "-" but erases the number before and after the "-" character.
is there a way to make the software to choose only the "-"I need?



questioner is fine with Notepad++ as text editor.










share|improve this question
















I use Search and Replace software, I need to erase a "-" character in many txt files.
The "-" always appears between two numbers but the numbers are always different (f.e: 1234567-8 or 34569-0).
there are other "-" that appears in the txt file but between letters, not numbers.
if I use [0-9]-[0-9] it chooses the "-" but erases the number before and after the "-" character.
is there a way to make the software to choose only the "-"I need?



questioner is fine with Notepad++ as text editor.







text-editing






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 24 '18 at 12:01









barlop

15.5k2388146




15.5k2388146










asked Dec 24 '18 at 8:13









Tim SelitskyTim Selitsky

11




11








  • 1





    What text editor are you using, and are you willing to switch to a different one if yours does not support certain features?

    – LPChip
    Dec 24 '18 at 8:46











  • Without telling us which text editor you're using, your question will be closed as too broad (this is true despite the fact you have received an answer you like). Please do not respond in the comments. Instead, edit the post with this information.

    – Twisty Impersonator
    Dec 24 '18 at 11:48











  • @TwistyImpersonator judging by his answer, he's obviously fine with notepad++

    – barlop
    Dec 24 '18 at 12:01











  • @barlop I don't feel comfortable editing that into his question. It feels a bit like putting words in his mouth.

    – Twisty Impersonator
    Dec 24 '18 at 12:13













  • @TwistyImpersonator Well I just did. I could have done it as a note, it doesn't matter. I think it's preferable to the question being closed because which text editor wasn't mentioned when we know he's fine with a specific one.

    – barlop
    Dec 24 '18 at 13:42
















  • 1





    What text editor are you using, and are you willing to switch to a different one if yours does not support certain features?

    – LPChip
    Dec 24 '18 at 8:46











  • Without telling us which text editor you're using, your question will be closed as too broad (this is true despite the fact you have received an answer you like). Please do not respond in the comments. Instead, edit the post with this information.

    – Twisty Impersonator
    Dec 24 '18 at 11:48











  • @TwistyImpersonator judging by his answer, he's obviously fine with notepad++

    – barlop
    Dec 24 '18 at 12:01











  • @barlop I don't feel comfortable editing that into his question. It feels a bit like putting words in his mouth.

    – Twisty Impersonator
    Dec 24 '18 at 12:13













  • @TwistyImpersonator Well I just did. I could have done it as a note, it doesn't matter. I think it's preferable to the question being closed because which text editor wasn't mentioned when we know he's fine with a specific one.

    – barlop
    Dec 24 '18 at 13:42










1




1





What text editor are you using, and are you willing to switch to a different one if yours does not support certain features?

– LPChip
Dec 24 '18 at 8:46





What text editor are you using, and are you willing to switch to a different one if yours does not support certain features?

– LPChip
Dec 24 '18 at 8:46













Without telling us which text editor you're using, your question will be closed as too broad (this is true despite the fact you have received an answer you like). Please do not respond in the comments. Instead, edit the post with this information.

– Twisty Impersonator
Dec 24 '18 at 11:48





Without telling us which text editor you're using, your question will be closed as too broad (this is true despite the fact you have received an answer you like). Please do not respond in the comments. Instead, edit the post with this information.

– Twisty Impersonator
Dec 24 '18 at 11:48













@TwistyImpersonator judging by his answer, he's obviously fine with notepad++

– barlop
Dec 24 '18 at 12:01





@TwistyImpersonator judging by his answer, he's obviously fine with notepad++

– barlop
Dec 24 '18 at 12:01













@barlop I don't feel comfortable editing that into his question. It feels a bit like putting words in his mouth.

– Twisty Impersonator
Dec 24 '18 at 12:13







@barlop I don't feel comfortable editing that into his question. It feels a bit like putting words in his mouth.

– Twisty Impersonator
Dec 24 '18 at 12:13















@TwistyImpersonator Well I just did. I could have done it as a note, it doesn't matter. I think it's preferable to the question being closed because which text editor wasn't mentioned when we know he's fine with a specific one.

– barlop
Dec 24 '18 at 13:42







@TwistyImpersonator Well I just did. I could have done it as a note, it doesn't matter. I think it's preferable to the question being closed because which text editor wasn't mentioned when we know he's fine with a specific one.

– barlop
Dec 24 '18 at 13:42












1 Answer
1






active

oldest

votes


















3














You can use lookahead and lookbehind. (?<=[d])-(?=d)



e.g. screenshot from notepad++



enter image description here



Be sure to tick the regular expression option



enter image description here



You can even replace - or whatever character, with the unicode code for it e.g. - is 002D which I see can be done in notepad++ as x{002D} (?<=[d])x{002D}(?=d)






share|improve this answer
























  • Works like a magic, thank you!

    – Tim Selitsky
    Dec 24 '18 at 8:31











  • @TimSelitsky If you no longer need help, please press the check box to mark this question as solved, so others know you no longer need help. :)

    – LPChip
    Dec 24 '18 at 8:47






  • 2





    @LPChip it's not a help site, where one marks a question as solved when it is answered. It's a QnA site and one where one doesn't mark a question as solved, but marks an answer as the solution if one decides that it answers the question. If the answer given answers it, which it does, then he should mark it as the answer. And f somebody finds another way to do it that is very good then one may post that anwer regardless of whether the person still needs help.

    – barlop
    Dec 24 '18 at 11:34








  • 2





    :@LPChip Just like, if a person posts a question then gives up, one might post an answer years later, after the person no longer needs help., because it's not a site to help the person that posts the question. It's a QnA site to help anybody looking for answer(s) to the question that was posted.

    – barlop
    Dec 24 '18 at 11:37











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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%2fsuperuser.com%2fquestions%2f1387318%2fhow-can-i-choose-an-exact-character-in-a-txt-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














You can use lookahead and lookbehind. (?<=[d])-(?=d)



e.g. screenshot from notepad++



enter image description here



Be sure to tick the regular expression option



enter image description here



You can even replace - or whatever character, with the unicode code for it e.g. - is 002D which I see can be done in notepad++ as x{002D} (?<=[d])x{002D}(?=d)






share|improve this answer
























  • Works like a magic, thank you!

    – Tim Selitsky
    Dec 24 '18 at 8:31











  • @TimSelitsky If you no longer need help, please press the check box to mark this question as solved, so others know you no longer need help. :)

    – LPChip
    Dec 24 '18 at 8:47






  • 2





    @LPChip it's not a help site, where one marks a question as solved when it is answered. It's a QnA site and one where one doesn't mark a question as solved, but marks an answer as the solution if one decides that it answers the question. If the answer given answers it, which it does, then he should mark it as the answer. And f somebody finds another way to do it that is very good then one may post that anwer regardless of whether the person still needs help.

    – barlop
    Dec 24 '18 at 11:34








  • 2





    :@LPChip Just like, if a person posts a question then gives up, one might post an answer years later, after the person no longer needs help., because it's not a site to help the person that posts the question. It's a QnA site to help anybody looking for answer(s) to the question that was posted.

    – barlop
    Dec 24 '18 at 11:37
















3














You can use lookahead and lookbehind. (?<=[d])-(?=d)



e.g. screenshot from notepad++



enter image description here



Be sure to tick the regular expression option



enter image description here



You can even replace - or whatever character, with the unicode code for it e.g. - is 002D which I see can be done in notepad++ as x{002D} (?<=[d])x{002D}(?=d)






share|improve this answer
























  • Works like a magic, thank you!

    – Tim Selitsky
    Dec 24 '18 at 8:31











  • @TimSelitsky If you no longer need help, please press the check box to mark this question as solved, so others know you no longer need help. :)

    – LPChip
    Dec 24 '18 at 8:47






  • 2





    @LPChip it's not a help site, where one marks a question as solved when it is answered. It's a QnA site and one where one doesn't mark a question as solved, but marks an answer as the solution if one decides that it answers the question. If the answer given answers it, which it does, then he should mark it as the answer. And f somebody finds another way to do it that is very good then one may post that anwer regardless of whether the person still needs help.

    – barlop
    Dec 24 '18 at 11:34








  • 2





    :@LPChip Just like, if a person posts a question then gives up, one might post an answer years later, after the person no longer needs help., because it's not a site to help the person that posts the question. It's a QnA site to help anybody looking for answer(s) to the question that was posted.

    – barlop
    Dec 24 '18 at 11:37














3












3








3







You can use lookahead and lookbehind. (?<=[d])-(?=d)



e.g. screenshot from notepad++



enter image description here



Be sure to tick the regular expression option



enter image description here



You can even replace - or whatever character, with the unicode code for it e.g. - is 002D which I see can be done in notepad++ as x{002D} (?<=[d])x{002D}(?=d)






share|improve this answer













You can use lookahead and lookbehind. (?<=[d])-(?=d)



e.g. screenshot from notepad++



enter image description here



Be sure to tick the regular expression option



enter image description here



You can even replace - or whatever character, with the unicode code for it e.g. - is 002D which I see can be done in notepad++ as x{002D} (?<=[d])x{002D}(?=d)







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 24 '18 at 8:19









barlopbarlop

15.5k2388146




15.5k2388146













  • Works like a magic, thank you!

    – Tim Selitsky
    Dec 24 '18 at 8:31











  • @TimSelitsky If you no longer need help, please press the check box to mark this question as solved, so others know you no longer need help. :)

    – LPChip
    Dec 24 '18 at 8:47






  • 2





    @LPChip it's not a help site, where one marks a question as solved when it is answered. It's a QnA site and one where one doesn't mark a question as solved, but marks an answer as the solution if one decides that it answers the question. If the answer given answers it, which it does, then he should mark it as the answer. And f somebody finds another way to do it that is very good then one may post that anwer regardless of whether the person still needs help.

    – barlop
    Dec 24 '18 at 11:34








  • 2





    :@LPChip Just like, if a person posts a question then gives up, one might post an answer years later, after the person no longer needs help., because it's not a site to help the person that posts the question. It's a QnA site to help anybody looking for answer(s) to the question that was posted.

    – barlop
    Dec 24 '18 at 11:37



















  • Works like a magic, thank you!

    – Tim Selitsky
    Dec 24 '18 at 8:31











  • @TimSelitsky If you no longer need help, please press the check box to mark this question as solved, so others know you no longer need help. :)

    – LPChip
    Dec 24 '18 at 8:47






  • 2





    @LPChip it's not a help site, where one marks a question as solved when it is answered. It's a QnA site and one where one doesn't mark a question as solved, but marks an answer as the solution if one decides that it answers the question. If the answer given answers it, which it does, then he should mark it as the answer. And f somebody finds another way to do it that is very good then one may post that anwer regardless of whether the person still needs help.

    – barlop
    Dec 24 '18 at 11:34








  • 2





    :@LPChip Just like, if a person posts a question then gives up, one might post an answer years later, after the person no longer needs help., because it's not a site to help the person that posts the question. It's a QnA site to help anybody looking for answer(s) to the question that was posted.

    – barlop
    Dec 24 '18 at 11:37

















Works like a magic, thank you!

– Tim Selitsky
Dec 24 '18 at 8:31





Works like a magic, thank you!

– Tim Selitsky
Dec 24 '18 at 8:31













@TimSelitsky If you no longer need help, please press the check box to mark this question as solved, so others know you no longer need help. :)

– LPChip
Dec 24 '18 at 8:47





@TimSelitsky If you no longer need help, please press the check box to mark this question as solved, so others know you no longer need help. :)

– LPChip
Dec 24 '18 at 8:47




2




2





@LPChip it's not a help site, where one marks a question as solved when it is answered. It's a QnA site and one where one doesn't mark a question as solved, but marks an answer as the solution if one decides that it answers the question. If the answer given answers it, which it does, then he should mark it as the answer. And f somebody finds another way to do it that is very good then one may post that anwer regardless of whether the person still needs help.

– barlop
Dec 24 '18 at 11:34







@LPChip it's not a help site, where one marks a question as solved when it is answered. It's a QnA site and one where one doesn't mark a question as solved, but marks an answer as the solution if one decides that it answers the question. If the answer given answers it, which it does, then he should mark it as the answer. And f somebody finds another way to do it that is very good then one may post that anwer regardless of whether the person still needs help.

– barlop
Dec 24 '18 at 11:34






2




2





:@LPChip Just like, if a person posts a question then gives up, one might post an answer years later, after the person no longer needs help., because it's not a site to help the person that posts the question. It's a QnA site to help anybody looking for answer(s) to the question that was posted.

– barlop
Dec 24 '18 at 11:37





:@LPChip Just like, if a person posts a question then gives up, one might post an answer years later, after the person no longer needs help., because it's not a site to help the person that posts the question. It's a QnA site to help anybody looking for answer(s) to the question that was posted.

– barlop
Dec 24 '18 at 11:37


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • 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%2fsuperuser.com%2fquestions%2f1387318%2fhow-can-i-choose-an-exact-character-in-a-txt-file%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

If I really need a card on my start hand, how many mulligans make sense? [duplicate]

Alcedinidae

Can an atomic nucleus contain both particles and antiparticles? [duplicate]