Questions tagged [grep]
A Unix command used to search files for the occurrence of a string of characters that matches a specified pattern.
104
questions
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 ...
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 ...
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 ...
4
votes
1
answer
353
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
4
votes
1
answer
272
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 ...
4
votes
2
answers
347
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 ...
4
votes
2
answers
874
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: ...
4
votes
1
answer
937
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 ...
3
votes
2
answers
613
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
...
3
votes
1
answer
236
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 ...
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 ...
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) ...
3
votes
0
answers
494
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?
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, ...
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 ...
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 ...
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, ...
2
votes
1
answer
331
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-...
2
votes
1
answer
834
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 ...
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 ...
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
...
2
votes
2
answers
524
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., ...
2
votes
1
answer
489
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 ...
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 ...
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 ...
2
votes
1
answer
775
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 ...
2
votes
1
answer
854
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
...
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, ...
2
votes
0
answers
36
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 - "...
2
votes
1
answer
122
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 ...
2
votes
0
answers
212
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 ...
2
votes
1
answer
506
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 ...
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 ...
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. ...
1
vote
1
answer
551
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 ...
1
vote
1
answer
187
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?
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 ...
1
vote
1
answer
57
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 ...
1
vote
1
answer
926
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
...
1
vote
1
answer
332
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:", "...
1
vote
1
answer
1k
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 ...
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 ...
1
vote
1
answer
435
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, „...
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://...
1
vote
1
answer
938
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 ...
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
1
vote
1
answer
929
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 ...
1
vote
2
answers
944
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".
...
1
vote
1
answer
486
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 ...
1
vote
1
answer
354
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 ...