MMayer asks on the id-extras forum:

I’m looking for a script or grep to find a paragraph with only one line, as well as one line in footnotes, and change it to another style. It should search the paragraph style with one line and change it to another style..

There are many ways of doing this, but it should be pretty simple. Here’s one suggestion:

// BS"D
// Find/Change Based on Line Count
// An InDesign script Copyright (c) Bookraft LLC, 2024
// Another freebie script from www.Id-Extras.com
// This code is released under the GNU Public License (GPL)

changeBasedOnLineCount(3); // <<< MODIFY THIS NUMBER
function changeBasedOnLineCount(n) {
   var finds, i, j;
   finds = document.findText(true);
   for (i = 0; i < finds.length; i++) {
      for (j = 0; j < finds[i].paragraphs.length; j++) {
         if (finds[i].paragraphs[j].lines.length === n) {
            finds[i].paragraphs[j].changeText();
         }
      }
   }
}

Save this code as a plain .txt file. Then change the extension to .jsx, and place in InDesign’s Scripts Panel folder.

Instructions

1. Open InDesign’s find/change dialog, and under the regular Text tab, set up a find and change query in whatever way you like.

2. Open the script and modify the number 3 (near where it says “MODIFY THIS NUMBER”). This number represents how many lines must be in the paragraph for the change to happen.

3. Run the script. Only paragraphs with the number of lines set in the previous step will be affected. Whatever you have set in the change options of InDesign’s find/change will be done to them.

That’s it! It’s quite a flexible script, because you can use it to change paragraph styles based on the number of lines in the paragraph, or do anything else (such as apply a special colour to all paragraphs with 7 lines in them), etc. The possibilities are endless.