Regex: Delete all operators/punctuation marks after the last word on a line

I have this sentence:

knowledge and spread of metaphysics - can become famous for cures and treatments : -= , *

I want to delete all operators/punctuation marks after the last word on a line, so the output should be:

knowledge and spread of metaphysics - can become famous for cures and treatments.

can anyone help me with a solution?

2

1 Answer

From comment:

I want to delete all special characters (except dot) after the last word on the line, and to replace with dot.

This does the job:

  • Ctrl+H
  • Find what: [^a-z]*$
  • Replace with: .
  • UNCHECK Match case
  • CHECK Wrap around
  • CHECK Regular expression
  • Replace all

Explanation:

[^a-z]* # 0 or more non alpha
$ # end of line

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like