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: "\ +"}

Tags: InDesign

Similar Questions

  • 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"

  • 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]:

  • Need help with this find/replace Script.

    Hi I got this script from Loic.Aigon.  And I got it works for find/replace simple changes however I Cannon operate for several changes.

     function cb5CallBack(target) {
            var findProps, changeProps;
            
                findProps = {findWhat:"Distributed by ",}   
                  changeProps = { changeTo:"Distributed by. ",}
                findProps = {findWhat:"Distribué par ",}   
                  changeProps = { changeTo:"Distribué par. ",}
                findProps = {findWhat:"Distribuido por ",}    
                  changeProps = { changeTo:"Distribuido por. ",},
              
            RTXT(target, findProps, changeProps);   
            } 
    

    function RTXT(target, findProps, changeProps)
    {
    app.findChangeTextOptions.caseSensitive = true;
    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.properties = findProps;
    app.changeTextPreferences.properties = changeProps;
    app.changeTextPreferences.properties = changeProps;
    target.changeText();
    }
    

    You must call the function RTXT repeatedly as well:

        var findProps, changeProps;

        findProps   = { findWhat:"Distributed by "};

        changeProps = { changeTo:"Distributed by. "};

        RTXT(target, findProps, changeProps);

        findProps   = { findWhat:"Distribué par "};

        changeProps = { changeTo:"Distribué par. "};

        RTXT(target, findProps, changeProps);

        findProps   = { findWhat:"Distribuido por "};

        changeProps = { changeTo:"Distribuido por. "};

        RTXT(target, findProps, changeProps);

  • Questions of character Tag search/replace

    FM 12.0.4.445 on Windows 7 Enterprise

    I created a character tag (Skip spelling) with all the properties defined on "such what" with the exception of the language, which is set to 'None '. The purpose of this tag must be FM to skip some words for spell checking. For example, my paper discusses many different file extensions, such as. TXT. DAT, etc. These terms may not be added to the dictionary due to the parameter 'space before' for periods, I don't want to change.

    By applying this tag character works fine, except in two cases:

    • All first, apply occasionally forces an end to the next line of a paragraph, as if the term has increased in size. Not a big deal, but I'm curious as to why this would happen. It also makes me wonder about the spread and stretch the parameters remaining at 0% and 100%, well I tried to delete the definition of character tag.
    • More important still, using find/replace with change = by gluing applies the new tag of character but also changes "BOLD" to plain text, especially in the "BOLD" headings. (Copy special > character Format has been used to copy the character tag.) Apply the tag of character directly for a term of "BOLD" does not remove the "BOLD". Is the find/replace properly configured or it is a bug?

    Thanks a lot for your help.

    I can't help much with respacing number. Check that your character Skip spelling format is really changing only the language. See what changes in the Character Designer when you apply the format, or save a MIF file and review the definition of your character Skip spelling format.

    Copy special > copy character Format all the properties of the formatting of characters. If the Find/Replace dialog box behaves as expected - which unfortunately for you, is not as intended.

  • Apply Find &amp; Replace Script for. INDB?

    Hi Chaps,

    Is it possible to apply a script to search for and replace type to an InDesign book (CS4 > .indb)?

    I have a folder .indb that my have a number of documents, each with the word 'EURO' in a number of tables. I want to change that to "GBP" in all documents, but would like to automate the process, instead of manually apply the script to each document.

    Does anyone know of a script for this?

    Much thanks

    Samuel

    Well, it's also quite possible to have a script open all documents, make your operations on each and then close them. See, for example, http://forums.adobe.com/message/2072111#2072111

    Google around scripts more - I've written several that do similar things.

  • object contains no text for find/replace

    I am trying to run this script to select text if it is found, but he said that there is no text, even though I have wrapped them in an if statement.

    See section function () {}

    app.findGrepPreferences = app.changeGrepPreferences = null;

    app.findGrepPreferences.findWhat = "the (section\\s +?). \\d+ ? [ \\.\\d+]?)";

    app.changeGrepPreferences.changeTo = "$1";

    The app.changeGrepPreferences reference .appliedCharacterStyle = "cross";

    If (app.activeDocument.findText ()) {}

    found. Select();

    };

    var changes1 = app.activeDocument.changeGrep ();

    If {(changes1.length===1)}

    Alert (changes1.length + "instance of 'the section' became 'article'.");

    } else {}

    Alert (changes1.length + "instances of 'the section' changed to 'section'.");

    }

    };

    Your message to find/replace script highlight found text is not the same question?

  • Using find/replace

    Is it possible to use the search/replace on an array of text feature?  For example, I want to search my document for any type of [Text1, Text2, Rem3 Rem4] and change the style of paragraph on this text.  I know I could create 4 different searches, but since they all change the same paragraph style, it would be much easier to just use a.  Thanks for any help.

    Yes, if you have InCopy CS3 or CS4, you can use GREP find/replace to do what you want.

    1. Discover all the stories, then you can find/replace
    2. Edition > find/change, GREP tab
    3. In find it this field, enter "text 1 | Text 2 | Text 3 "(sans les guillemets)." The vertical bar character means 'or '.
    4. Let the change to the empty field
    5. Click the button change in format at the bottom and select the name of your paragraph Style in the first Panel of Options of Style
    6. Run a search/replace to test

    hope that helps!

    AM

  • GREP find/change - how to change time of uppercase letters to lowercase?

    I'm doing some final, proofreading and correction of the text in a book I helped design.

    I've had some success using GREP find/replace.  But I can't make it work in the following case.

    I want to do is find all occurrences of 'Nature' and change to 'nature '. (Uppercase to lowercase simple substitution.)

    BUT I want to exclude all instances of 'Mother Nature'. (Keep uppercase "n" in Nature.)

    Assistance from Adobe, I should be able to use a negative Lookbehind expression.  I tried to type in the search box... Nature(?<!) The mother)

    But he finds everything... 'nature', 'Nature', 'Mother Nature', which is not much help.

    Can someone please tell me where is my mistake and how to correct?

    Search: (?)

    Replace with: nature

    Peter

  • 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.

  • Find/replace style cell with GREP

    Hi all, (my first post here)

    I found a script very useful on this forum to find/replace cell styles in an array. I adapted the script using Peter Kahrel ebook for use with a GREP query.

    I've linked to a spreadsheet in InDesign CC 2014 I want to highlight the cell of new products that contain the value [Y].

    When I run the script below, I get random results.

    myDoc = app.activeDocument var

    app.findGrepPreferences = app.changeGrepPreferences = null

    app.findGrepPreferences.findWhat = "\[\u\"]

    var myFound = myDoc.findGrep)

    for (i = 0; i < myFound.length; i ++)

    {

    If (. parent.constructor.name myFound [i] == "Cell")

    {

    . parent.appliedCellStyle myFound [i] = "New_Product_Cell".

    }

    }

    Modify the script that I wrote above.

    Otherwise your discovery is just '[u]' ==> multi-ad found is--> Direct manufacturer name


    Jarek

  • Use Grep to find/replace

    I'm trying to find how to use GREP in find/replace of chage the formatting of a text which is a spreadsheet.

    I worked on the GREP query "~ b (\d\d) ~ b ', which is a paragraph return, followed by two digits, followed by another paragraph of return

    and then it is replaced by ' \t $1 ~ b ', which is a tab, found two numbers and a paratrooper returned.

    What I have to do is change the query to search for ANY number of digits, (which may be delimited by commas: e.g. 23, 36, 48, 50), then replace with a tab + found text.

    I guess what I'm looking for is a way for the query find "any text between two paragraph returns, no matter what that length", but I don't know how to do this. All of the generic options seem to find a single exampler (a figure, a character etc.)

    And you came so far

    Repetition operators are? (zero or one), * (zero or more) and + (one or more times). You can also specify the exact number: {at least up to the}.

    All of these operators are "greedy" by default - they match as much as possible. To to match as less as possible (which I'm sure you will come, sooner or later), add another? After the expression of repeat.

    If this is a number, then possibly another (which will be always included):

    \D\d?

    and what a figure, then zero or as much as 9999999,93856 million:

    \D\d*

    which is functionally identical

    \d+

    And it is between 3 and 8 figures but will be forced to use the shortest possible match:

    \d{3,8}?

    Having said that: a quick & dirty solution for your real problem is to find any amount of numbers, spaces, and comma:

    ~ b [\d,] + ~ b

    (there are more here because otherwise it would correspond also to an empty line). The [..] a list of the hooks - it will match to any unique inside code.

    A more complicated but 'cleaner' way is looking very precisely that for many, comma, space, number sequences - it is cleaner because it lines poorly trained (comma without a space) is fried!

    (She also has another code - operators in parentheses. Look at their place in a good reference GREP - lost people are enthusiastic about Peter Kahrel O'Reilly title, because there on the use of GREP in InDesign.)

    ~b\d+(, \d+)*~b)

  • How find/replace just a story of VB script.

    Hi all

    I use a lot of find/change grep options in my VB script. But find/replace replace always in each textframe I have on my current document. I would like to define just to do this on a story (which would be on the selected text blocks). Can anyone help? I try to find that in virtue of
    FindChangeGrepOption, but I see this is not the place. I have attached the screenshot so you can see what I set in my VB script.

    Thank you.

    The trick is to target the research of history of interest. In JavaScript, I would write something like this (with the first installation the find/replace):

    myStory.changeGrep ();

    Dave

  • Find/replace, highlight found text script

    Hello

    I wrote this script and it works fine. But what I want to do is to go through each word found individually (as in the Find/Replace dialog box with the button "find next").

    This is an excerpt:

    app.findTextPreferences = app.changeTextPreferences = null;
    var what = app.findTextPreferences.findWhat = "ensure";

    app.changeTextPreferences.changeTo = "make" sure;
    var found = app.activeDocument.changeText ();
    If {(found.length = 1)
    Alert (found.length + "instance of"ensuring"changed");
    } else {}
    Alert (found.length + "instances of"ensuring"changed");
    }

    I want the script to each instance of "ensure" my active selection that I can see where they are before I change.

    Thank you

    Hi guys,.

    try this one:

    app.findTextPreferences = app.changeTextPreferences = null;
    app.findTextPreferences.findWhat = "ensure";
    app.changeTextPreferences.changeTo = "make sure";
    
    var allFounds = app.activeDocument.findText();
    for (var i = 0; i < allFounds.length; i++) {
      var curFound = allFounds[i];
      curFound.select();
      app.layoutWindows[0].zoomPercentage = app.layoutWindows[0].zoomPercentage;
       if(confirm("Do you wish to change this instance?",undefined, "Find/Replace")) {
         curFound.changeText();
      }
    }
    
    app.findTextPreferences = app.changeTextPreferences = null;
    

    Disadvantage of the confirm dialog box: there is no exit button.

  • script to run several queries to find/replace

    Working on a big book of ID document (* .indb), I saved dozens of queries to search/replace (named "col01', 'col02' etc.) that I run on 'all documents '. For some reason, I have to run these queries several times a day.

    So I'm wondering if he has, or if someone out there will write: a script that runs these queries one after another. Given the size of the book, it may be necessary to provide the script to pause after each query (before it turns on with the next), but I'm just guessing.

    Any help is very appreciated!

Maybe you are looking for