Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!
-
Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!
I need to remove the ‘’-‘’ character, but only if it comes at the end of every line, not if it’s in the middle.
I also have the idea of making every lines text backwards, putting it in alphabetical order, so I can see where the ‘’-‘’ character is at the end, then reversing the text.
But. I’m having trouble finding an answer that works in the latest notepad++ 64-bit I’m using. -
Example. –
– Change this –
ads-asd-
asdf-dfasdf-a-
asafd-asdfs-
a-s–d-f–ef-as-– To this –
ads-asd
asdf-dfasdf-a
asafd-asdfs
a-s–d-f–ef-asFor over 9000 lines.
That’s it.
Please help me!
-
@anontests said in Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!:
I need to remove the ‘’-’’ character, but only if it comes at the end of every line, not if it’s in the middle.
Use the Replace function. Make the search mode “regular expression”. Tick wrap around option.
Find:-$
Replace With: this field needs to be empty.
Click on Replace All and the entire file will be processed.The
$
sign denotes end of line. It doesn’t get deleted, just your character does.Terry
-
@Terry-R said in Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!:
@anontests said in Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!:
I need to remove the ‘’-’’ character, but only if it comes at the end of every line, not if it’s in the middle.
Use the Replace function. Make the search mode “regular expression”. Tick wrap around option.
Find:-$
Replace With: this field needs to be empty.
Click on Replace All and the entire file will be processed.The
$
sign denotes end of line. It doesn’t get deleted, just your character does.Terry
It works! Apparently!
Thank you!
Follow-up question! Sorry! One more thing.
Please help me! How do you remove a certain character that only comes at the beginning of a line? Please help me!
Example. –
– Change this –
-ads-asd-
-asdf-dfasdf-a-
-asafd-asdfs-
-a-s–d-f–ef-as-– To this –
ads-asd-
asdf-dfasdf-a-
asafd-asdfs-
a-s–d-f–ef-as-For over 9000 lines.
The reason I ask this is that I actually put all the lines in alphabetical order to remove the ‘’-‘’.
So I would like to know how I can remove it from the beginning, while still keeping the same order.
Sorry.
Please help me!
-
@anontests said in Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!:
Please help me! How do you remove a certain character that only comes at the beginning of a line? Please help me!
Very similar solution. The ^ character represents the start of a line. These are very basic principles in regular expressions.
So Find What:^-
.So you should check out the links in the FAQ section about regular expressions. These are basic principles in regular expressions. I strongly suggest you start learning about them. You will be surprised how easy it is at the basic level to understand and write these.
Terry
-
@Terry-R said in Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!:
@anontests said in Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!:
Please help me! How do you remove a certain character that only comes at the beginning of a line? Please help me!
Very similar solution. The ^ character represents the start of a line. These are very basic principles in regular expressions.
So Find What:^-
.So you should check out the links in the FAQ section about regular expressions. These are basic principles in regular expressions. I strongly suggest you start learning about them. You will be surprised how easy it is at the basic level to understand and write these.
Terry
Oh. I see. Perfect!
Thank you!
I’m not sure where the FAQ section about regular expressions is.
https://community.notepad-plus-plus.org/category/7/faq
FAQ | Notepad++ Community
As I can’t find something that exactly says that, and I’m not sure what you want me to look at specifically, or if it’s even this forum FAQ section.
You don’t have to link to it. As I have my question answered now. But I don’t know where to go. Exactly.
Oh. Sure. This post is probably good for people who look-up answers on the world wide web, or something, and don’t know much at all. And, again, I’m not sure where to look exactly. But. Sure. Thanks for the advice.
Thank you!
-
@anontests said in Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!:
I’m not sure where the FAQ section about regular expressions is
FAQ Desk: Where to find REGEX documentation ?
Is the post. Forgot it had the word REGEX which is just REGular EXpression shortened.Terry
-
@Terry-R said in Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!:
@anontests said in Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!:
I’m not sure where the FAQ section about regular expressions is
FAQ Desk: Where to find REGEX documentation ?
Is the post. Forgot it had the word REGEX which is just REGular EXpression shortened.Terry
Oh okay.
https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regex-documentation
FAQ Desk: Where to find REGEX documentation ? | Notepad++ Community
So I guess that’s it. Noted.
Thank you!
-
Hello , @anontests, @terry-r and All,
I’ve just updated the title of the Regex FAQ !
Best Regards,
guy038
-
@guy038 said in Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!:
Hello , @anontests, @terry-r and All,
I’ve just updated the title of the Regex FAQ !
Best Regards,
guy038
Oh. Thank for that! That should be really helpful for new people who don’t know that an abbreviation of ‘‘REGular EXpressions’’ is ‘‘REGEX’’.
Thank you!
-
Very similar solution. The ^ character represents the start of a line. These are very basic principles in regular expressions.
So Find What:^-There’s a caveat with this one.
Say the line is like this:-------------I'm a line
Then a regex operation using^-
would affect ALL of the-
, not just the first one.
HERE is another posting discussing an alternative technique to only handle the first character, when multiple of same are involved. -
@Alan-Kilborn said in Please help me! How do you remove a certain character that only comes at the end of a line? Please help me!:
Very similar solution. The ^ character represents the start of a line. These are very basic principles in regular expressions.
So Find What:^-There’s a caveat with this one.
Say the line is like this:-------------I'm a line
Then a regex operation using^-
would affect ALL of the-
, not just the first one.
HERE is another posting discussing an alternative technique to only handle the first character, when multiple of same are involved.Oh.
Well, to be honest, I actually did want to remove all of them from the 1st and last line, and I think I just did ‘‘replace all’’ over and over again until they were all gone. Haha.
But, yeah, that’s useful for anyone that specifically needs to remove a certain character from the beginning, but wants to keep the same character.
Thank you!