Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
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

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
2.2K
Translate
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

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+\. .+

 

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

This should work:

 

Statute:.+\r

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

Translate
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

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

Thanks so much.

Translate
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

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

Translate
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

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?

Translate
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

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.

Translate
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

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

Translate
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

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+\. .+

 

Translate
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

Amazing. Thanks so much!

Translate
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
LATEST

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

Translate
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