11 votes
Accepted

InDesign: how to remove everything between square brackets

You don't need to script this, just hit Ctrl+F and switch to the 'GREP' tab type \[[^]]*\] in the 'Find what' field or type the same thing with an \s? added in front to also remove any preceding ...
Lucian's user avatar
  • 29.3k
6 votes
Accepted

InDesign: grep style to move single i words to next line

Create a character style and set it to "No break". Edit your existing paragraph style, go to the GREP Style tab, choose the character style you created above and type (?<=\s)i\W+ in the "To Text" ...
Lucian's user avatar
  • 29.3k
4 votes
Accepted

InDesign GREP: not replacing the search

Search for (?<=\w)\t and replace by a space (or \s ) FYI: This will strictly look for a tab placed after any word character.
Vinny's user avatar
  • 4,593
4 votes
Accepted

InDesign: how to find all numbers followed by a period

Use \s(\d\.) in the 'Find what' field. \s is the space and (\d\.) defines an expression made up of a digit and a full stop and $1 in the 'Change to' field. this removes the space and keeps the ...
Lucian's user avatar
  • 29.3k
3 votes
Accepted

GREP terms for searching a dash followed by a string of numbers and a paragraph break

Your question is somewhat unclear but you could do the following in InDesign with GREP: — 12345 try: ^ — \d{5} — 123456 try: ^ — \d{6} — 1234567 If you're looking for a range from 12345 to ...
user9447's user avatar
  • 18.3k
3 votes

Use GREP to replace multiple characters

Indeed a script can do it: //Main routine var main = function() { //==================VARS==================// var //The document doc = app.properties.activeDocument, //Find Grep Preferences in ...
Loic's user avatar
  • 701
3 votes

InDesign: how to apply styles to specific words/phrases

An automated way is to use GREP Styles via the Paragraph Style options. This feature is automatic so every time the phrase appears it will instantly apply the formatting without any manual search ...
Lucian's user avatar
  • 29.3k
3 votes
Accepted

Find unwanted paragraph marks (GREP, find, replace, script)

Two criteria for your Find: Use this GREP search: \r(?!\d) And specify "Paragraph Style 1" in the Find Format field. GREP search looks for a paragraph mark \r, not followed by a digit (a "negative ...
MG_'s user avatar
  • 1,521
3 votes
Accepted

Underline all initials after a tab

Solution 1 You can achieve this with 2 Grep styles (in the right order). First catch all uppercase characters and apply underline character style to this first query: \u+ Then catch all ...
Vinny's user avatar
  • 4,593
3 votes

inDesign GREP styles

The regular expression engine chooses the first match that's possible. For example the regular expression foo|foo bar will never match foo bar simply because it will always match foo first. See the ...
joojaa's user avatar
  • 57.9k
3 votes
Accepted

How to search for the Nth (2nd, 3rd, etc.) white space in a paragraph?

Solution Find what (([^\s]*\s?){n})\s(.*\r) where n is a number of your choice. Change to $1text$3 where text is the text you want to change the nth space to. Explanation Find what ( /...
Wolff's user avatar
  • 20.9k
3 votes
Accepted

Indesign GREP: Find sentence until first occurence of specific character

Never mind. ##.+?## is the answer. Sometimes after ages of struggle you simply have to ask the question to suddenly find the answer yourself. +? keeps the search to the first complete sequence.
SabineR's user avatar
  • 423
3 votes

How to use GREP to only style a part of the expression?

This should work in your case: (?<=\u )\u[^\u\s].*Favorite or the more general: (?<=\u )\u[^\u\s].*\l Explanation (?<=\u ) - first we search for any uppercase character followed by a space (...
Wolff's user avatar
  • 20.9k
2 votes

GREP style after double line break

You should never, ever use multiple line breaks... If your text reflows, line breaks could be located on top of a column or a frame, which is definitely not what you want (see example below). I ...
Vinny's user avatar
  • 4,593
2 votes
Accepted

Indesign GREP search includes too much

By default, GREP is greedy: as long as there is a match to be found further on, it will grab as much as possible. Since the . does not match (by default) a hard return character, it will usually scan ...
Jongware's user avatar
  • 4,238
2 votes

Underline all initials after a tab

It’s all depends of your actual text... If you just have a bunch of lines with Acronymes you can use this simple one. \u(?=\l+)
Jean-Claude Tremblay's user avatar
2 votes
Accepted

Is there an environment with GREP outside of InDesign?

They are called regular expressions (regexp). Most good editors have regexp support. Pesonally i use Scite, but most good text editors have this support these include but are not limited to notepad++...
joojaa's user avatar
  • 57.9k
2 votes

Targeting every second tab using Grep and then changing it to nothing

OK, there are 2 tactics that you can take here. You could match what you ask, its a bit tricky it would be easier to match "line ending in tab", which would solve your current situation more easily: ...
joojaa's user avatar
  • 57.9k
2 votes

InDesign CC GREP Help. Adding spaces around "+" (plus) symbol

My friends found the answer on this thread: https://forums.adobe.com/thread/2207571 I needed to use double backslash in the text file. So this works! {findWhat:"(\\d)(\\+)(\\d)"} {changeTo:"$...
LazarusBlack's user avatar
2 votes

InDesign GREP is not searching [any] styles

Turns out this is a bug that Adobe posted a fix for! GREP was failing to search forward in documents with over 50k words https://helpx.adobe.com/indesign/kb/search-issue-in-long-documents.html
Andrew Ly's user avatar
2 votes
Accepted

Can I automatically apply a different paragraph style to all paragraphs beginning with a specific character style?

Enter Edit > Find/Change and choose the Text tab. Make sure that the Find what and Change to fields are empty. Set Search to Document. Click the Find Format field and choose the character style used ...
Wolff's user avatar
  • 20.9k
2 votes
Accepted

Grep: Search between "beginning of a paragraph" and colon :

In the beginning you have (?=^). A Positive Lookahead that looks ahead to see if a Beginning of Paragraph comes after whatever text you have before the lookahead (in this case none). Then you have *? ...
Wolff's user avatar
  • 20.9k
2 votes
Accepted

Indesign GREP: Negative lookbehind with variable length

Assuming all your text is black, you could first apply some other color to URLs, then perform the GREP find/change to all black text and finally change the color of URLs back to black. Create a color ...
Wolff's user avatar
  • 20.9k
2 votes
Accepted

Append avatar image to each paragraph in chat style book

You can easily add the same anchored object multiple places using Find/Change. Make sure the avatar image has an Object Style so you can later change its settings. Copy the object containing the ...
Wolff's user avatar
  • 20.9k

Only top scored, non community-wiki answers of a minimum length are eligible