Skip to main content
Inspiring
September 10, 2026
Question

how to better this regular expression ?

  • September 10, 2026
  • 6 replies
  • 46 views

Hello,

I send you my FM file.

Actually, I use this regular expression :

Find :      , (\b.+\b)(\n|$)

Change :  ($1),  

So I do “Find” then “Change§Find”, and I have this result where the blank line has been removed before the last paragraph (begining by “La Saison 10 ...”). How to set the regular expression in order to keep this blank line ?

 

 

    6 replies

    frameexpert
    Community Expert
    Community Expert
    September 10, 2026

    You likely can’t do this with a single regular expression. This is one of those “conditional” tasks where a decision needs to be made based on content. That is usually where scripting comes in.

    www.frameexpert.com
    Inspiring
    September 11, 2026

    @frameexpert 

    Ok, I understand, Rick.

    I send you another example (FM file and screenshot) where I have used your regular expression.

    In that case, the last line of text is moving at the end of the precedent line. Is it possible to do something in your regular expression in order that the last line does not move ?

     

     

    frameexpert
    Community Expert
    Community Expert
    September 11, 2026

    Not that I can think of. In all of your samples, the paragraphs all have the same Format. I assume that they will be have particular formats in the finished document. For example, all of the paragraphs that you want merged would have a unique Paragraph Format. Then you would target these paragraphs with your regular expression. This would still require scripting because you would have to specify which paragraphs to apply the regular expression too. Regular expressions are useful and powerful, but there are limits to Find/Change, especially if you want to use Change All.

    www.frameexpert.com
    Dave Creamer of IDEAS
    Community Expert
    Community Expert
    September 10, 2026

    Not a direct answer, but I always leave the End of Flow [EoF] symbol at the end of the text. I do not have a paragraph return at the end of text with the EoF symbol on a line by itself. I find that being on a line by itself can inset a (seemingly) blank page if the EoF symbol ends up on a page by itself. 

    David Creamer: Community Expert (ACI and ACE 1995-2023)
    frameexpert
    Community Expert
    Community Expert
    September 10, 2026

    Try this find:

    , (\b.+\b)(?:\n|$)(\w)

    with this change:

     ($1), $2

    (There is a leading space on the change.)

     

    www.frameexpert.com
    Inspiring
    September 10, 2026

    Hello Rick ​@frameexpert ,

    I have tried your regular expression, and it work very well, but for “mezzo-soprano” we should have :   (mezzo-soprano)