Questions tagged [grep]

A Unix command used to search files for the occurrence of a string of characters that matches a specified pattern.

Filter by
Sorted by
Tagged with
6 votes
3 answers
5k views

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

I need a Grep style in my paragraph styles in InDesign that makes sure that the letter i cannot stand alone at the end of a line, but will always move to the beginning of the next line. I have a ...
Christina's user avatar
5 votes
1 answer
3k views

InDesign: how to remove everything between square brackets

I have a script to find all textframes in a document, and do a regular expression to remove (if contains) all text inside square brackets. For example the text frame might contain: "Lorem ipsum ...
lanes123's user avatar
  • 197
4 votes
2 answers
6k views

How to do a wildcard / GREP / regex find-replace in Illustrator?

InDesign can do advanced find - change AKA find - replace using GREP rules AKA regex AKA regular expressions which allows all sorts of wildcard rules and automation. Is there any way to do the same ...
user56reinstatemonica8's user avatar
4 votes
1 answer
338 views

Grep expression for m3 ha−1

I tried to replace m3 ha−1 into m3 ha−1 with no success. What is wrong with my expression? (?i)(?<=\<m)3(?= ha\>)-1
supershivas's user avatar
4 votes
1 answer
236 views

Automatically convert H2 to H₂ when typing in Indesign?

I have to regularly type the word H2 into documents for my job. I always forget to make the 2 subscript I've been watching David Blatner's Indesign secrets and I figured I could use either, commonly ...
Aasim Azam's user avatar
  • 1,309
4 votes
2 answers
346 views

Underline all initials after a tab

In my Indesign Style (CS6 on Windows 7) I want to apply the style underline to all initials that come after a tab. NASCAR National Association for Stock Car Racing So the initials all get ...
bgmCoder's user avatar
  • 217
4 votes
2 answers
862 views

InDesign, Grep and Syntax Highlighting

I have to make an e-book that contains code snippets. I am using GREP to select all code tags (bounded by <> — triangular brackets), and apply a custom style to them. The RegEx I have developed: ...
Tudor's user avatar
  • 43
4 votes
1 answer
935 views

How can I use GREP to get all text between the third and fourth underscore in a file name?

In the firm I work for, they have file naming system. It always has 5 sections as in the examples below: File Name: YYMMDD_PROJECT NUMBER_PROJECT NAME_FILE NAME_initials.ext 140527_207_AL MURR ...
user3244505's user avatar
3 votes
2 answers
600 views

Matching 3 lines following a term using GREP

Here is a sample of the text. NEW! Certificate in Office Operations (3 parts) Office Operations Cyber Security for Managers Embracing Sustainability in the Workplace Intro to 3D Printing ...
jseymour186's user avatar
3 votes
1 answer
221 views

GREP style for three digit code NOT followed by specific characters

I'm trying to set up a GREP style that will style a 3 digit code (example 789) but not apply that style when the code is followed by the characters ct. So the style would apply to the 100 in "100 ...
user128966's user avatar
3 votes
1 answer
61 views

Assign a tag to text-block if

How can I assign a tag to a textblock if that textblock only if the textblock had a specific value inside (at the very beginning of the block actually. 95% of my used textblocks within my indesign ...
Daiaiai's user avatar
  • 268
3 votes
1 answer
2k views

Indesign numbering new line & indentation

I am getting crazy with these two things and after some days of getting nothing from Web search and experimentation I come to you. I am using Indesign CS4 and cannot get to do these two things: 1) ...
user1156544's user avatar
3 votes
0 answers
472 views

Adobe Indesign: How to look for the first line in each paragraph

How can I look for the first line in each paragraph, and add a line break after it?
i. Madar's user avatar
2 votes
1 answer
4k views

InDesign: how to find all numbers followed by a period

I have a list which consists of (goes up to 9): 1. 2. 3. And i want to make them: 1. 2. 3. But, they all have a space before the number, I haven't found a regex to find all these occurrences, ...
lanes123's user avatar
  • 197
2 votes
2 answers
1k views

Change HTML tag styles with GREP in InDesign

I have some HTML in a text and I would like to apply a character style to the HTML tags: <p>This is some <strong>HTML</strong> I want to use.</p> I want to only change the ...
JeffThompson's user avatar
2 votes
1 answer
1k views

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

I have an InDesign CS6 document with a lot of numbered paragraphs. They begin with a number and end with a paragraph mark. However, there are some paragraphs which have unwanted paragraph marks in the ...
Ad Astm's user avatar
  • 155
2 votes
1 answer
2k views

inDesign GREP styles

I have a few documents that have legal lines for 4 different countries (Japan, China, Macau, and Arabic) The legal line is composed for the most part of english and then the japanese characters, ...
surfertide's user avatar
2 votes
1 answer
301 views

Indesign GREP: Negative lookbehind with variable length

I use a complex .txt for the basic findchangebylist-script that is included in inDesign to fix some common typography mistakes. F.e. it changes the hyphen to an en dash and puts a thinspace between 3-...
SabineR's user avatar
  • 423
2 votes
1 answer
785 views

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

I imported this tabbed text from Microsoft Word into Indesign as shown in the attachment. I am attempting to replace every second tab in this text into no character ie any tab number that is ...
Jonathan Beech's user avatar
2 votes
1 answer
3k views

Get the start and finish of text in a certain character style in Indesign GREP

I've been fighting with InDesign GREP find/change quite a bit and couldn't find any way to get it to look at the start and the end of a character style. This is necessary if, for example, you want to ...
user56reinstatemonica8's user avatar
2 votes
4 answers
2k views

How can I use GREP to find all text between bullet and equals sign in bullet list in InDesign?

I have a bulleted list with several entries, it's a list of keyboard shortcuts, similar to the text below: alt+shift+ctrl+2 = Lock Others alt+shift+ctrl+3 = Hide Others alt+ctrl+b = Blend ...
Mr.Syrax's user avatar
2 votes
2 answers
451 views

Indesign: GREP lookbehind

I'm trying to automatize giving character styles to the editor given names (not the author names) in literature sources like this one via Find/Change (not GREP styles): Jacobs, G. A., Boero, J. V., ...
SabineR's user avatar
  • 423
2 votes
1 answer
460 views

InDesign, Grep - what is the base syntax of InDesign grep

There are many regex syntax, one different from the other: .Net regex, Java regex, PHP/PCRE regex, Python regex. etc. Some sites for checking & testing regex expressions are just great - like ...
Yeshurun Kubi's user avatar
2 votes
1 answer
1k views

Punctuation space after number in footnotes

I'm working on a journal in which there is a lot of footnotes. (17 articles, aprox 30 pages each with at least 30 footnotes). I use superscript nested style to make the number of every footnote in ...
Mate Penava's user avatar
2 votes
2 answers
1k views

InDesign GREP everything between two consecutive returns and a digit(or)return

Say I have some text in the following format: What I am trying to style, using GREP, is the beginning of every new paragraph (that comes after an empty line), until a digit or return is reached, so ...
verism's user avatar
  • 73
2 votes
1 answer
748 views

InDesign Paragraph Styles, Object Styles & GREP

New to the forum, so apologies if this has possible been covered before. I work in catalogue creation and we've recently transferred over to InDesign I'm trying to recreate our price lozenges in ...
Benjamin Lake's user avatar
2 votes
1 answer
846 views

GREP duplicate line of text

Is it possible to duplicate lines of text with GREP? Here is exactly what I would like to do; I have a list of letters and numbers that looks like this: R1H3BOA2HA4 R1H3BOA2H4 R1H2H3BO4 ...
user23596's user avatar
2 votes
1 answer
3k views

How could I use Indesign's find by grep feature to find and format words between to underscores?

Lets say I have a bunch of text that needs to be italic. Throughout my text, italics are represented as: _word_ _any_ _car_ And so on... I want to find these, and replace them with word, car, any, ...
Astor139's user avatar
  • 123
2 votes
0 answers
35 views

Adding a title before several paragraphs of a certain paragraph style

In Indesign, I need to insert a fixed title (something like - "law") before each group of paragraphs of a certain paragraph style, and another title right after it (something like - "...
i. Madar's user avatar
2 votes
1 answer
111 views

How do I grep from the match closest to the end?

I have a sequence of titles and description in my text following a pattern similar to Data A: foo; Data B: bar; Data C: baz; Data D: qux I want to bold just the titles, so I wrote the following GREP ...
Firefighter's user avatar
2 votes
0 answers
202 views

Does someone know of a script to automatically put specific texts as footnote text?

A little while ago I made this post. Because of that I can automate placing footnote references where they are needed. Now the problem is that the actual footnote texts are just placed randomly in the ...
Sillius Soddus's user avatar
2 votes
1 answer
484 views

InDesign: Automatic change character color of running headers if they have background?

I have been looking to solve this problem: I am designing a book with many pages printed with different colors. Is there any way to make the running header change character color depending on weather ...
Anastasia's user avatar
2 votes
0 answers
2k views

Change all uppercase letters in a named style to initial case (Indesign Grep)

This is my first post here. I have Peter's (forgot his last name) excellent change case-script so I can do the replacement with no problem, but the find is baffling me. I have a glossary where the ...
Bob Katz's user avatar
1 vote
2 answers
4k views

InDesign: how to apply styles to specific words/phrases

Is it possible to change the font style of specific phrases within an .indd document? I have several phrases to update in a giantic wall of text and all I need to do is change the font to a cursive. ...
Whytek's user avatar
  • 350
1 vote
1 answer
513 views

Indesign GREP: Find sentence until first occurence of specific character

the text I work with has marked each words or sentences that should be a marginalia with ##before and after## as in: Edi nos di occus aceaqui blam rerorent eumetur aut eaquid qui ut velibus quid ...
SabineR's user avatar
  • 423
1 vote
1 answer
161 views

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

How to search (via GREP) for the Nth (2nd, 3rd, etc.) white space in a paragraph in Adobe Indesign?
i. Madar's user avatar
1 vote
2 answers
1k views

Indesign grep: Grab everything but

I need to be able to grab the birth year in a summary of a number of people. I know how to grab exactly 4 digits and I know how escape any digit. But I cannot seem to be able to combine the two. Here ...
Jakob Thuemoes's user avatar
1 vote
1 answer
39 views

Setting up a GREP find and proper nouns

I'm trying to set up a GREP which will find the proper nouns in my document and apply a character style to them which I will then use to preclude them from a spellcheck (I'm trying to avoid having to ...
Daniel James Smith's user avatar
1 vote
1 answer
656 views

InDesign GREP that matches select characters between two strings

I am trying to typeset a dictionary, and at the end of many of the word entries, there are additional references the reader can consult. ...definition here. For further reference, apple; fruit; tree ...
Reagan McCaffrey's user avatar
1 vote
1 answer
245 views

InDesign: Regex/GREP works on tester, not in InDesign - issue with OR/| operator?

I have the following sample text: Writing: Gnusto. Editing: Caskly. Circulation: Izyuk. I'm trying to use a GREP regex to select only the job titles and colons (i.e. "Writing:", "...
sparc_spread's user avatar
1 vote
1 answer
902 views

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

I try to apply a style to a string of words that is beginning a paragraph and before a colon. I prepared a first Grep search but it is not working (it is only placing the cursor before the colon ...
supershivas's user avatar
1 vote
4 answers
3k views

InDesign: Using GREP to style URLs, email addresses, phone numbers, social handles, and hashtags

I'm brand new to GREP and its uses in InDesign, and while I'd like to understand it in a more robust way someday, at the moment I'm struggling to find some resources that can explain just the basics ...
kduz's user avatar
  • 71
1 vote
1 answer
413 views

Indesign GREP search includes too much

It is driving me crazy and I have no idea what I am doing wrong. In my document I have to autoformat some regular expressions in and including the brackets. An example is here; [DP, 07.04.1911, „...
maegmaeg's user avatar
  • 113
1 vote
1 answer
3k views

GREP rule to catch all types of web link / URL

I'm looking to build a robust, reliable GREP rule to catch all web links and URLs that appears in text, covering all possible characters and gotchas like HTTPS, or URLs in brackets like (http://...
user56reinstatemonica8's user avatar
1 vote
1 answer
925 views

Using grep to finding long digit series and inserting thin spaces into them

On my page i have a table with over 500 rows, in it one column where all cells contain a different numbers, such as 55123, 666000, 3000 and 1459000 (figures for sums of money). I would need to insert ...
JJxyz's user avatar
  • 13
1 vote
3 answers
4k views

GREP - Apply Character Style until carriage return

Is there a way to tell InDesign via GREP to apply a Character Style to the first paragraph of a text box before a carriage return? Not a forced line break. A carriage return. Thank you
gmorissette's user avatar
1 vote
1 answer
890 views

How can I use GREP in InDesign to swap numbers then nest, then repeat

Long time lurker, first time poster! Your tips are really valuable and have taught me what I know till now about GREP, thank you! I have a tricky text to style and I am having some issues, and need ...
addepp's user avatar
  • 11
1 vote
2 answers
715 views

GREP Style Capital first letter

Is it possible to create a GREP function that will automatically change the first letter to capital letter in a word? For example: "moonlight" and GREP changes it to "Moonlight". ...
vanoevelenstef's user avatar
1 vote
1 answer
413 views

Indesign GREP - find lines before a string but exclude string

I am struggling to find some GREP to find lines before a string when I need to exclude the string itself from the selection. In this example, I need to find the 2 lines before "Fox", but ...
RobC's user avatar
  • 13
1 vote
1 answer
347 views

GREP InDesign, can I move a word to the beginning of a paragraph?

Is there a way to move an entire specific word at the beginning of the sentence it belongs to? Let's say I want words contained within brackets to be repositioned. At the moment I have something like ...
Markus Reed's user avatar