Skip to main content
Participant
Nov 6, 2026 5:18 AM UTC
Answered

cannot search for multiple para returns and replace them with single

i had to go hunting to find out remove multiple para returns to change them to single paras

wasted time and could not find a answer

it should be availabe in the find and replace like every text application currently does

 

    Kurt Gold
    Kurt GoldCorrect answer
    Community Expert
    Nov 9, 2026 10:19 PM UTC


    Mic,

    as far as I understand your task, you have text objects that contain multiple consecutive paragraph breaks (and therefore empty paragraphs) which you want to change into just single paragraph breaks.

     

     

    If that applies, you may try this javascript snippet:

     

    if (app.documents.length && app.activeDocument.selection.length) {
    function f(item) {
    if (item.typename === "TextFrame") {
    item.contents = item.contents.replace(/\r\n/g, "\r").replace(/[ \t]*\r(?:[ \t]*\r)+/g, "\r");
    } else if (item.pageItems) {
    for (var i = 0; i < item.pageItems.length; i++) f(item.pageItems[i]);
    }
    }
    var sel = app.activeDocument.selection;
    for (var j = 0; j < sel.length; j++) f(sel[j]);
    }

     

    Usage:

    - Select one or multiple text objects.

    - Run the script.

    Please report back if it works for you.

    4 replies

    Harshika Verma
    Community Manager
    Community Manager
    Nov 12, 2026 11:25 AM UTC

    Hi ​@micshics,

    We would like to follow up on your issue. Did you try the workaround suggested by our expert? Let us know if that helps. You may also want to upvote the UserVoice request shared in this post. 

    Thanks,
    Harshika​​​​​​​

    Translate
    Kurt Gold
    Community Expert
    Kurt GoldCommunity ExpertCorrect answer
    Community Expert
    Nov 9, 2026 10:19 PM UTC


    Mic,

    as far as I understand your task, you have text objects that contain multiple consecutive paragraph breaks (and therefore empty paragraphs) which you want to change into just single paragraph breaks.

     

     

    If that applies, you may try this javascript snippet:

     

    if (app.documents.length && app.activeDocument.selection.length) {
    function f(item) {
    if (item.typename === "TextFrame") {
    item.contents = item.contents.replace(/\r\n/g, "\r").replace(/[ \t]*\r(?:[ \t]*\r)+/g, "\r");
    } else if (item.pageItems) {
    for (var i = 0; i < item.pageItems.length; i++) f(item.pageItems[i]);
    }
    }
    var sel = app.activeDocument.selection;
    for (var j = 0; j < sel.length; j++) f(sel[j]);
    }

     

    Usage:

    - Select one or multiple text objects.

    - Run the script.

    Please report back if it works for you.

    Translate
    Ton Frederiks
    Community Expert
    Community Expert
    Nov 9, 2026 10:38 AM UTC

    ​@micshics the workaround as mentioned by ​@CORCTON34033231  is currently the only way. You may want to add your vote here:

    https://illustrator.uservoice.com/forums/333657-illustrator-desktop-feature-requests/suggestions/32630167-add-paragraph-return-p-as-a-special-character-i

    Translate
    CORCTON
    Community Expert
    Community Expert
    Nov 6, 2026 6:00 AM UTC

    Hi, you're right that Illustrator's Find and Replace doesn't offer a special code for paragraph returns the way InDesign does — so you can't type a code for them. The workaround is to copy the return character itself into the dialog:

     

    1. Click into the text, place the cursor at the end of a paragraph, and press Shift + Right Arrow to select the paragraph break, then Copy.

    2. Open Edit > Find and Replace and paste that break into the Find field. To collapse two returns into one, paste two paragraph breaks in Find (select two consecutive breaks in the text and copy them).

    3. Copy a single paragraph break and paste it into the Change field, then click Replace All. Run Replace All again if you have three or more returns in a row, since each pass only removes one extra return.

     

    One note: this copy-and-paste method has been reported to work on Mac, but not reliably on Windows in older versions, so if the Find field won't accept the pasted break, please let us know which platform and Illustrator version you're on.

    Translate