InDesign CC Grep find/replace to replace the character of space per paragraph (fly)

Hello InDesigners,

I'm trying to clean up a 99 page document. In the file, titles of chapters, in capital letters, followed by a space, which is then followed with text more uppercase there. This always occurs at the beginning of a paragraph.

I'm trying to target the space character that appears just after the number of chapter and Exchange to a number (fly).

For example:


CHAPTER 22 SUNDAY UNDERGROUND

I want the Grep to change this as follows:

CHAPTER 22

SUNDAY UNDERGROUND

I know that to do this job, I need to use positive look behind and positive Look Ahead, at first, I just tried to isolate CHAPTER 22 using the following:

^ \u{2,}\s\d+

It worked. However, as soon as I cut and paste into P.L.B., find/replace says that it does not match.

(?<=^\u{2,}\s\d+)\s


The culprit seems to be the comma that comes just after the number 2. If I take, I get a match, but just not the one I wanted.


Why P.L.B. does not accept the comma as part of the range in my definition grep?


(FYI, I prefer to use wildcards with a specified scope, rather than literal text).

It is indeed the comma, and the reason why it does not work because the flavor of InDesign's GREP does not allow a variable length argument in its lookbehinds. And the construction "has {x, y}" indicates a variable length.

"Chapter" only you know how many characters to uppercase, and even the exact text, you can use

(?<=^CHAPTER>

the first chapters to a number, then

(?<=^CHAPTER>

for the rest. In your version of InDesign, I guess there is also a possible solution with the fairly new \K "forget - me" operator but I have not yet enough experience with that. It should look like this:

^ \u{2,}\s\d+\K\s

but you will have to experiment a bit to see how to work with the replacement string.

In addition, you should only use the name of "fly" for a character that looks like this: "¶". The code that you insert will call it a 'return' or 'paragraph return. Initially, I took your question literally, and it sounded as if you were after this result: "CHAPTER 22 ¶ SUNDAY UNDERGROUND"

Tags: InDesign

Similar Questions

  • GREP find/replace + paragraph Styles

    Hello

    I'm editing a long document and have benefited from the assistance of the community already, but being new GREP Style, find/replace, I need to ask for additional help.

    Below a screenshot of the script (original). Two blocks of text you see anticipated by the icons have have styles of different paragraphs. Icons are placed like custom glyphs.

    Now, the last line with C2, 9, 14,... is the target of this post. They are buses of London and I created a paragraph with another icon. The copy that I work with unfortunately is as you see. Buses will follow «;»

    Resulting to place a \r after the semicolon and assign the new paragraph style. The item to work with is (probably) the last "," before the registration of the bus. All entries have it in the same way, where a search/replace global grep should work fine.

    My attempts:

    I used of a previous debate (? < =------;)) [^ ;] + $ to match everything from the end until the last semicolon, but then I found the problem preserving the matched characters and placing \r (using the (? < =-;). start at the beginning and stops at each point comma + space)

    So question: how to stop at the first semicolon at the end and replace the space with \r to create a new paragraph?

    Then, it is two question :-)

    From my previous attempts, I noticed that when you replace the semicolon + space with \r, and change the style of paragraph at a time (from Rail to Bus) caused the Rail paragraph style change (logic) to the style of Bus. So I tried to say the paragraph style of the track "Following paragraph Style is style of Bus" (and not to change the paragraph style in find/replace), but in a way that no longer works.

    Second question is: given to split the find/replace in two steps, how then transform / apply to newly created paragraph the correct style of Bus?

    Thank you in advance for your valuable assistance. So far, the community has been great!

    Antonio

    Original

    Screen Shot 2016-07-12 at 22.32.23.png

    Result for

    Screen Shot 2016-07-12 at 22.54.51.png

    Hi Antonio,.

    If I understand correctly, in 2 regex [1 click play with Multi/find-replace our friend Martinho da Gloria]:

  • Find/replace the numbers?

    I like very much all my numbers in small caps, but always manually go through and change them all. Can I find/replace all numbers with a number of small capitals? CS3/Mac

    You can do this by using a GREP.

    1. go in the tab GREP in the FInd\Change dialog box find it what field type in \d

    2. in article Format change click on the empty area and in the dialog box that opens, go to the tab "Basic character Formats" and chose small caps of the case drop down. OK to the dialog box

    3. change all

    You can save this query to other references.

    Thank you

    Javed

  • [win] [js] [cs4] find/replace the paragraph styles without losing the replacements the

    Hi guys I need some help here.

    I created a javascript script that will find and replace paragraph styles for the DOCFILE with indesign paragraph styles. everything works fine but the problem is that, when she applies paragraph styles, he loses all replacements the. I tried:

    changetext (false);

    but his does not work, this is a kind of conditional parameter that I can put in the function changetext() so that it used clear local overrides?

    Thank you.

    Horse

    Use findGrep() (or findText()) instead of changeText(). This returns an array of items found. Then, you can loop through the array and apply a paragraph style without erasing the replacements (the 2nd parameter must be false).

    Example:

    Main();
    
    function Main() {
        var foundItem;
        var doc = app.activeDocument;
    
        app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
    
        app.findGrepPreferences.findWhat = ".+";
        app.findGrepPreferences.appliedParagraphStyle = "Body text";
    
        var foundItems = doc.findGrep();
    
        for (var i = 0; i < foundItems.length; i++) {
            foundItem = foundItems[i];
            foundItem.applyParagraphStyle(doc.paragraphStyles.item("Body"), false);
        }
    
        app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
    }
    
  • can I find/replace the leader tab character?

    I have a Word document that I'm slope in ID and there are a lot of different tab with the leaders of the dot stops. The dot leaders are a simple point, but I want not a 'space-point' in order to spread them out more.

    I can't understand how to find a tab with a character specific point leader and change to another - if it was a uniform set of rules of text I want to make a Style with what I wanted and find/replace all, the problem is, is that there are a few pieces of text with two tabs three and four as well as "BOLD" and regularly mixed in so I have to make a Style for all versions of tab stops and it's longer than I want to take with it.

    So, is it possible to change only the leader? What is Grep something?

    TIA

    ID CS5 7.0.4 MacPro 8-core, 14 GB of RAM, Snow Leopard

    I think that may have to be scripted?

    However, you can do a search for "^ t".

    And increase the tracking/kerning in the change format (200 should do)

    Maybe do a replace/find so you can't change something unexpectedly.

  • I'm looking for links Hypertext in find/replace the dialogue (without applying a character style).

    I have 7000 hyperlinks in my document, with different character styles ("italic", "bold" and "italic +"BOLD""). I need to apply the blue color to each of them. If I ask a new character style "hyperlink" to all, I'll lose my formatting.

    Is there a way to find hyperlinks (for themselves, not their format) dialog find/replace in order to create and apply 4 different character styles ('hyperlink_regular', 'hyperlink_bold', 'hyperlink_italic' and ' hyperlink_bold + italic")?

    Sorry for my English, thanks for the help!

    Use Javascript!

    You can use this Javascript, for example. (Instructions on how to use a JavaScript in InDesign can be found elsewhere).

    blue = app.activeDocument.swatches.item("Blue");
    for (a=0; a
    

    Take care to provide the correct color swatch name in the first line.

  • REPLACING THE CHARACTER FROM THE RIGHT.

    Hey everybody,

    The replace() function replaces a character "." from the left by default.

    var txt:String = "2.5.";


    If (txt.indexOf(".") == 1) / / aid (txt.lastIndexOf(".") == 1) does nothing.

    {

    txt = txt.replace(".","");

    trace (txt); 25.

    }

    There must be a simple method to replace "." from the right so that the vectorised result is "2.5".

    If the point is always the last tank:

    txt = txt.replace (/ \. $/, "");

  • Find/replace a character between 'any number'

    Greetings

    I'm working on a long document in Norwegian that contains many numbers with decimal places, like this: 45.3

    However, in Norwegian, is the correct way of separation of decimals with a comma, like this: 45.3

    What is the best way to find and modify all instances of this?

    I tried a text search using ^ 9. ^ 9 (any digit. any number) who works in a way. The problem changes the results so that I keep the numbers, but change the period to a comma.

    Obviously I can't just look for a period, because they are everywhere...

    Any suggestions would be much appreciated!

    Hey!

    You can do it with GREP find change:

    Hope that helps.

    --

    tomaxxi

    http://indisnip.WordPress.com/

  • Replace the comma with space - we can do it without REGEXP?

    11 GR 2 DB.

    Can you replace comma with a space without using REGEXP?
    Sample String: 'To,Replace,,Comma(s),,,,with space,,,'
    Expected output:'To Replace Comma(s) with space '

    884476 wrote:
    11 GR 2 DB.

    Can you replace comma with a space without using REGEXP?

    You could do it with REPLACE nested...

    select    replace(
                replace(
                  replace(
                      'To,Replace,,Comma(s),,,,with space,,,',',','#$'
                         ),
                      '$#',''
                       ),
                     '#$',' '
                     ) str
    from dual;
    
    STR
    -------------------------------
    To Replace Comma(s) with space 
    
  • How to find "font family" in the character Panel?

    I'm sure this used to be the "failure." I'm having a problem that, when I use the character Panel to search for a particular font family, I am obliged instead to apply a font as well as the family of fonts (see image).

    ceQAucY.png

    As you can see above, I'm looking for "Cambria". I don't want to make my choice, but only the font Cambria one family bold or italics (or any other font). I don't know I used to be able to do this and the font of the selection have been preserved (so that the fat remained "BOLD", remained regular regular, etc., provided these fonts exist within the family of fonts), but for the life of me I can't find the option to change and no amount of research has turned up of everything related.

    Can someone help me?

    Well, after you have selected the options that don't seem not related, it seems that I stumbled across the solution. Rather than keep to myself and go, I'll post it here in case a person always has the same question.

    As seen here, I changed the option "search first word only." Then allows me to search only the font family:

  • A question of character grep find/replace script

    Hello

    I'm changing the FindChangeList.txt on javascript in indesign cs4 to allow me to automate some grep commands, but we have a problem: in indeisgn if I use the search/replace tool, it works fine, but it doesn't work on the script.

    is what I'm trying to change all instances of + (plus) in a document ± but it seems that the script is read as "nothing more nothing, how to recognize the + as a symbol rather than as a command?

    the line that I use in my code is as follows:

    grep {findWhat: '+'} {changeTo: '±'} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false}

    Thank you

    Try {findWhat: "\ +"}

  • Developer SQL 4.1.0.17 ai2 - strangeness of find/replace the editor

    Try to search (and replace) behaves a bit strange:

    Starting with (ctrl-F), if the text is selected, the search text is not at all! :

    Find-replace 1.png

    Result:

    Find-replace 2.png

    Is that what someone sees something similar?

    Running Windows.

    Details:

    On

    -----

    Oracle SQL Developer 4.1.0.17

    Version 4.1.0.17

    Build a HAND - 17.29

    The IDE version: 12.2.1.0.42.141118.0806

    Product ID: oracle.sqldeveloper

    Product version: 12.2.0.17.29

    Version

    -------

    Version of the component

    =========    =======

    Oracle IDE 4.1.0.17.29

    Java (TM) Platform 1.8.0_40

    Support versioning 4.1.0.17.29

    What is EA1 or ai2? My version of ai2 is 4.1.0.18 not 17 as you mentioned.

    Ai2, I don't get a popup but I did in EA1. Also find and replace was pretty useless in EA1, but seems to be working (not extensively tested yet) in ai2.

  • How to find/replace the file path

    Hi all

    How can you find where your collections are stored in the bridge?  How can you change this default file path?

    Thank you!

    R

    On Windows 7 is the collections folder:

    C:\Users\USERNAME\AppData\Roaming\Adobe\Bridge CS5\Collections

    You cannot change this location.

    The collections are text files containing the location of the selected files, and the files in the collection has an extension of .filelist

  • GREP does not not in the first word of a paragraph. What's wrong?

    I'm having a small problem using GREP in a paragraph style. It does not apply the requested character style if the word is in the first paragraph. This is the condition:

    ( ? i) Data: | Description: | Hora. Monday: | Information: | Local: | No site. Object. OBS.: | Telefone. Type:


    Nobody knows why, in what's happening?

    Maybe every other word that data must leave a space in front of her to match.

  • Do find/replace multiple records at the same time?

    Hello

    I wonder if there is a way to apply the options find/replace, I select all the records that I have given merged in my InDesign file.

    Reserved spaces will not import my database spaces, example if I

    Model InDesign: < < bird > >

    < < beak > > < < beak value > >

    .csv:                              bird's beak,,, value of beak

    Eagle, beak:, Hung

    I get

    InDesign after the merger of data: Eagle

    beak: hung

    No spaces came with the merger.  If there is an option to preserve the spaces, it would be the simplest solution. However, I'm not finding such a command, so I would like to add a special character after my colon in the .csv and then use ID to find/replace this character in each of my files in a space or two.  Any ideas?

    Thank you.

    Edit: even on a single record, find/replace is not applied to my output document, either... Its release the special character that I wrote in the fields of .csv instead of space, it is supposed to transform.

    Post edited by: EX_Achilles

    Yes.

    Make sure that you set the scope of the search and replace of the Document. He may have missed the selection or history.

Maybe you are looking for