• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
9

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

Explorer ,
Jun 12, 2023 Jun 12, 2023

Copy link to clipboard

Copied

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.*

TOPICS
How to , Scripting

Views

425

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Jun 12, 2023 Jun 12, 2023

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

 

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

Replace by: *

 

or

 

Find: Baseball\X*\K$

Replace by: *

Votes

Translate

Translate
Guide ,
Jun 12, 2023 Jun 12, 2023

Copy link to clipboard

Copied

Find: Baseball.*\K$

Replace by: *

 

(^/)  The Jedi

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 12, 2023 Jun 12, 2023

Copy link to clipboard

Copied

Thank you, FRIdNGE!! Much appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 12, 2023 Jun 12, 2023

Copy link to clipboard

Copied

Find:

(Baseball|baseball)(.+)

Change to:

$0*

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 12, 2023 Jun 12, 2023

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 12, 2023 Jun 12, 2023

Copy link to clipboard

Copied

(?s)Baseball.*\K$

 

(^/)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 12, 2023 Jun 12, 2023

Copy link to clipboard

Copied

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!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 12, 2023 Jun 12, 2023

Copy link to clipboard

Copied

Now I see you can just add the asterisk to the change. The first time I tried, it didn't work:
Find: (?s)Baseball.*\K$
Change: *



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 12, 2023 Jun 12, 2023

Copy link to clipboard

Copied

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

 

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

Replace by: *

 

or

 

Find: Baseball\X*\K$

Replace by: *

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 12, 2023 Jun 12, 2023

Copy link to clipboard

Copied

LATEST

LOL! Thanks FRIdnge!! You're the best and I appeciate the help!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines