0

I want to select and delete only the first word at the beginning of each line

For example:

My favorite flower is yello.
I love cars.
Book and flowers are my game.

The Output should be:

favorite flower is yello.
love cars.
and flowers are my game.

2 Answers 2

1
  • Ctrl+H
  • Find what: ^\S+\h*(.*$)
  • Replace with: $1
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline
  • Replace all

Explanation:

^           # beginning of line
\S+         # 1 or more non space
\h*         # 0 or more horizontal spaces
(.*$)       # group 1, rest of the line

Replacement:

$1          # content of group 1

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here

0
  • Ctrl+F
  • Find what: (?:^([a-z][A-Z]{0}))
  • Replace by: \2\2
  • CHECK Wrap around
  • CHECK Regular expression
  • Find All in Current Document
3
  • 1
    [A-Z]{0} doesn't make sense, and you don't have group #2 so \2 is empty.
    – Toto
    Oct 27, 2021 at 8:57
  • yes, @Toto but if you test it with notepad++, you will see that my formula is working fine . Of course, your regex is much better. Thanks
    – Just Me
    Oct 27, 2021 at 8:58
  • Find: ^[a-zA-Z] and Replace: EMPTY will do exactly the same. But, as your attempt, it will leave a space at the beginning of line.
    – Toto
    Oct 27, 2021 at 9:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .