Skip to main content
Inspiring
June 12, 2023
해결됨

Grep Question: Command to find word then go to end of paragraph to insert asterisk

  • June 12, 2023
  • 2 답변들
  • 1080 조회

Can you use GREP to find a word (example "baseball") then go to the end of the paragraph and insert an asterick?

Before
Baseball is a sport played between two teams.
It is a bat-and-ball game.

 

After

Baseball is a sport played between two teams.
It is a bat-and-ball game.*

이 주제는 답변이 닫혔습니다.
최고의 답변: FRIdNGE

Thanks, FRIdNGE but that just added "(^/) to the end:

Baseball is a sport played between two teams.

It is a bat-and-ball game.(^/)

 

NEVERMIND! LOL!! I didn't realize (^/) is part of your signature!!!


(^/) is just my signing on Forums! 😉

 

Find: (?s)Baseball.*\K$

Replace by: *

 

or

 

Find: Baseball\X*\K$

Replace by: *

2 답변

Community Expert
June 12, 2023

Find:

(Baseball|baseball)(.+)

Change to:

$0*

jimDcleveland작성자
Inspiring
June 12, 2023

Thank you, Jeffery_Smith!
I just realized that both solutions just go to the end of the sentence. Is there a way to go to the end of the story?

FRIdNGE
June 12, 2023

(?s)Baseball.*\K$

 

(^/)

FRIdNGE
June 12, 2023

Find: Baseball.*\K$

Replace by: *

 

(^/)  The Jedi

jimDcleveland작성자
Inspiring
June 12, 2023

Thank you, FRIdNGE!! Much appreciated.