Get paragraph containing...?

Let’s say I have a string of text with a few paragraphs (or lines) in it, like this:

set theText to "Hello1

Is there any way I can get the first paragraph containing “Hello2”?

repeat with aParagraph in every paragraph of theText
if aParagraph contains "Hello2" then
return aParagraph
end if
end repeat

Is that what you are looking for?

Awesome. That’s exactly what I’m looking for.

Just moved the topic to the appropriate forum :wink: