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

In GREP, how to find a line of text, starting with a specific word and ending with a paragraph mark

Participant ,
Mar 01, 2022 Mar 01, 2022

Copy link to clipboard

Copied

I'm trying to find a line of text that starts with a specific word plus a colon and ends with a paragraph mark. I played around with some wild cards and/or positive look behind but clearly am not adept enough at these kind of seraches to figure this out. Here's an example of the specific text I want to find:

 

        Statute: Section 1202. State Certificates.

 

Every line starts with "Statute: " and ends with a paragraph mark (return). FYI, after I find this type of line, I want to change its Paragraph style, which I know how to do.

 

 

TOPICS
How to

Views

747

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 2 Correct answers

Community Expert , Mar 01, 2022 Mar 01, 2022

This should work:

 

Statute:.+\r

 Capture d’écran 2022-03-01 à 15.33.05.jpg

Votes

Translate

Translate
Community Expert , Mar 01, 2022 Mar 01, 2022

As long as the ones you don't want to find are not at the beginning of a paragraph, this should work. It finds your text when it occurs at the beginning of a paragraph.

 

^~6 \d+\.\d+\. .+

 

Votes

Translate

Translate
Community Expert ,
Mar 01, 2022 Mar 01, 2022

Copy link to clipboard

Copied

This should work:

 

Statute:.+\r

 Capture d’écran 2022-03-01 à 15.33.05.jpg

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
Participant ,
Mar 01, 2022 Mar 01, 2022

Copy link to clipboard

Copied

It does!!!! (I was making it too complicated, I guess.)

Thanks so much.

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 ,
Mar 01, 2022 Mar 01, 2022

Copy link to clipboard

Copied

Are there instances where this pattern appears mid-paragraph, and if so, are those instances not intended to change to the new paragraph style?

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
Participant ,
Mar 01, 2022 Mar 01, 2022

Copy link to clipboard

Copied

Good question. I'm pretty sure the answer is no. And jmlevy's answer, above, worked for me.

But, just for my edification, if I'd said yes, do you have a suggestion?

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
Participant ,
Mar 01, 2022 Mar 01, 2022

Copy link to clipboard

Copied

Actually, I do have other instances where the answer is YES, so I'm definitely interested in your response to this! I know I could put a \r in front of it to find only the instances where it's on its own line, but then the change Para Style would apply to the previous para, right?

 

FYI, In this case, a sample stand-alone line I am looking for would be:

 

     § 49.143. Vocational Instructional II.

 

The would always start with "§ ". But there are numerous cases where "§ " appears in the middle of a para, which I would not want to find.

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 ,
Mar 01, 2022 Mar 01, 2022

Copy link to clipboard

Copied

I asked becasue I was not yet able to find a solution that would exclude mid-paragraph instances. Every solution I tried so far also found the mid-paragraph instances, and selected from there to the end of the paragraph. 

Screen Shot 2022-03-01 at 10.51.43 AM.png

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 ,
Mar 01, 2022 Mar 01, 2022

Copy link to clipboard

Copied

As long as the ones you don't want to find are not at the beginning of a paragraph, this should work. It finds your text when it occurs at the beginning of a paragraph.

 

^~6 \d+\.\d+\. .+

 

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
Participant ,
Mar 01, 2022 Mar 01, 2022

Copy link to clipboard

Copied

Amazing. Thanks so much!

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 ,
Mar 01, 2022 Mar 01, 2022

Copy link to clipboard

Copied

LATEST

^§\h[0-9.]+\h.+

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