1. Find Sentences Not Starting with a CAPITAL
This expression finds sentences that begin with a lowercase letter and end with a period. Great for catching mis-formatted paragraphs.
^[a-z].+?\.A toolbox for editing books in Adobe InDesign. Copy any expression directly into InDesign's Find/Change dialog. When using a replacement value of $1, the expression removes formatting markers so you can then apply styles with a hotkey (e.g., N + H + F1 for italics).
This expression finds sentences that begin with a lowercase letter and end with a period. Great for catching mis-formatted paragraphs.
^[a-z].+?\.Find text wrapped in underscores or asterisks. When you replace with $1, it removes the markers so you can then apply italics using your hotkey (e.g., N + H + F1).
_([A-Za-z ]+)__([^_]+)_$1Removes one or more incorrect paragraph breaks that appear before a sentence beginning with a lowercase letter. Collapses the line(s) so the sentence flows correctly.
\r+([a-z].+?\.)$1 $1Finds any text surrounded by standard double quotation marks.
"([^"]+)"Matches text wrapped by a single asterisk on each side — useful for finding bold or emphasis markers.
\*([^*]+)\*Matches text wrapped by double asterisks — the markdown bold syntax.
\*\*([^*]+)\*\*Locates Roman numeral sequences like chapter numbers or act/scene labels.
\b([IVXLCDM]{2,}|[VXLCDM])\bFinds quotation marks that aren't preceded by ] or followed by [, ensuring dialog tags are properly marked.
(?<!] )"(?!\[)(?=\S)Inserts six soft returns before paragraphs with the Title style to help center them on the page.
// Define the paragraph style name
var titleParagraphStyle = "Title";
// Get the active document
var doc = app.activeDocument;
// Loop through all text frames in the document
for (var i = 0; i < doc.textFrames.length; i++) {
var textFrame = doc.textFrames[i];
// Loop through all paragraphs in the text frame
for (var j = 0; j < textFrame.paragraphs.length; j++) {
var paragraph = textFrame.paragraphs[j];
// Check if the paragraph has the paragraph style "Title"
if (paragraph.appliedParagraphStyle.name == titleParagraphStyle) {
// Insert 6 soft returns before the title
paragraph.insertionPoints[0].contents = "\n\n\n\n\n\n";
}
}
}
alert("Six soft returns added before all paragraphs with the 'Title' style.");Checks the active document for pages containing text with the Title paragraph style. When found, it applies a designated master page named D-Parent to those pages.
var titleParagraphStyle = "Title";
var dParentMasterPageName = "D-Parent";
var doc = app.activeDocument;
if (!doc.saved) {
alert("Please save the document before running this script.");
} else {
var pageCount = 0;
for (var i = 0; i < doc.pages.length; i++) {
var page = doc.pages[i];
var containsTitle = false;
var textFrames = page.textFrames;
for (var j = 0; j < textFrames.length; j++) {
var textFrame = textFrames[j];
var paragraphs = textFrame.paragraphs;
for (var k = 0; k < paragraphs.length; k++) {
if (paragraphs[k].appliedParagraphStyle.name == titleParagraphStyle) {
containsTitle = true;
break;
}
}
if (containsTitle) break;
}
if (containsTitle) {
pageCount++;
try {
var masterPage = doc.masterSpreads.itemByName(dParentMasterPageName);
if (masterPage.isValid) {
page.appliedMaster = masterPage;
} else {
alert("Master page '" + dParentMasterPageName + "' is not valid.");
}
} catch (e) {
alert("Error applying master page: " + e);
}
}
}
alert("Master page '" + dParentMasterPageName + "' applied to " + pageCount + " page(s).");
}