Regex: Add hyphen dash at the beginning of the line, where it does not exist hyphen dash

good-afternoon. I want to add hyphen (dash) at the beginning of the line, where doesn't exist hyphen dash. For example I have this text:

I love books. I want some money. I need help. - I want to ask you something. - I want to love you. I need hits. - I get done with this. 

The Output should be:

- I love books. - I want some money. - I need help. - I want to ask you something. - I want to love you. - I need hits. - I get done with this. 

1 Answer

Add a hyphen dash at the beginning of the line, where doesn't exist hyphen dash.

FIND: ^(?!-)

REPLACE BY: -\x20

or

FIND: ^(?!-)(?:\r?|\r)

REPLACE BY: -\x20

If you want to add a hyphen (dash) only where there are blank lines:

FIND: ^(?!-)\s*\r

REPLACE BY: -\x20

or

FIND: ^(?!-)(?!\w+)

REPLACE BY: -\x20

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