Find/Change - GREP vs. TEXT

Today, thanks to this amazing forum, I discovered that I had been using "Find/Change" under TEXT, instead of GREP.
Using "Find/Change" as GREP for finding & replacing seems to be MUCH MORE POWERFUL than "TEXT."
What are the disadvantages of using "Find/Change" GREP ?  I notice it cannot do "case sensitive" — any other cons?

GREP searches can be either case insensitive on or off
case insensitive on:  (?i)
Case insensitive off  (?-i)
Example:
Search for either "case" or "Case"    (?i)case    found on 1st, 2nd and 3rd line
Search for just "Case"     (?-i)Case    found on 3rd line only

Similar Messages

  • Find Change through external text file

    Hello folks
    I am bit pretty in InDesign scripting so could you please look into this.
    How can i change any particular text field in Indesign CS3 document from text file.
    I do have find change script but for each InDesign document specific text file is assigned.
    So each time i have to modify find change GREP property that is also repetetive of work. Is there any way to get find change information should be extract from external text file.
    Many Tanks in advance

    In the FindChangeByList script, you could customize the function myFindFile(myFilePath) {...} as to search the FindChangeList text file in the document location rather than the script location. That's an example. The question is: given a document, where will you have the corresponding FindChangeList?
    @+
    Marc

  • Find/Change Grep only finds one instance per paragraph, where am I going wrong?

    Hi,
    I've been using a Find/Change Grep to find any price with a comma and change that comma to a thin space (Newspaper's editorial style).
    But the Grep only finds the first instance of this per paragraph.
    Sample text...
    "$200,000 $200,000 $200,000.
    text at start of paragraph $200,000
    $200,000 text at end of paragraph
    tab     $200,000."
    In the sample the grep would miss the second and third price on the first line.
    I've been using...
    Find...
    (?<=\$)(\d{3})\,?(\d{3})
    also tried (\$\d{3})\,?(\d{3})
    Change to...
    $1~<$2
    Is there anything I can add to find these last two prices?
    I've been using this in combination with Batch Find Replace script, so different greps are set up for 5,6 and 7 digit numbers that start with $.
    Thanks.

    Try this,
    Find what: (?<=\x{0024})(\d{3})\,?(\d{3})
    Change to: $1~<$2
    Vandy

  • Find/Change GREP - FindChangeByList - help!

    Hi,
    Can anyone help with my GREP problem? I have a long unformatted list of products, I need a couple of GREP find and change queries to help format the list. The formatting will be based on paragraph styles for product header, description and product code. I have GREP working correctly to find the product code lines and apply the 'product code' paragraph style, but I'm struggling to target the product header line. The product header is on the next line after the product code, or it could be found on the line above the product description. I need GREP to find the product header to apply the product header paragraph style. I'm looking at using FindChangeByList; so far I have the folowing:
    grep
    {findWhat:"(Product Code|Product code)$"}
    {appliedParagraphStyle:"Product Code-green"}
    The above line finds all the Product Codes and applies the paragraph style. It works perfectly well from Indesigns Find/Change panel and FindChangeByList.
    But the next bit doesn't work:
    grep
    {findWhat:"^(?<=\\r)", appliedParagraphStyle:"Product Code-green"}
    {changeTo:"", appliedParagraphStyle:"Product Header-green"}
    I've tried to target the 'Start of a paragraph (^)' (this will be the product header) that has - 'Paragraph Break (\r)' with the 'Product Code-green' applied (this is the product code), in front of it. - (Am I right in thinking that in the FindChangeByList script I need 2 slashed on \\r - I have tried with 1 and 2 - no joy.)
    If I do this in Indesigns Find/Change panel it does kind of work. If I click find, it will find the correct point, and click change, it will apply the correct style to the product header - BUT if I click CHANGE ALL - it doesn't work. It reports '0' instances found, yet if i click Find again it will find the next instance. So it's kind of working on an individual click and find basis, but not on global change all - STRANGE? And it doesn't work at all when run from FindChangeByList.
    Anybody got any thoughts on why this is happening? or a better piece of GREP to try? Would really like it to be running from FindChangeByList. Hope the above makes sense.
    Thanks

    Hi,
    You can go straight or try to modify 'MultiFind' script.
    I suggest to use a text conditions and go straight with this code:
    var
              mDoc = app.activeDocument,
              mCond = mDoc.conditions.item("mFound"),
              mPath = "~/Documents/ID_words_to_find.txt",
              mDelimiter = ",",
              mSource = File(mPath),
              mOpen = mSource.open("r",undefined,undefined),
              len, len1, mWordsArr, mFound;
    if (!mCond.isValid)
              mCond = mDoc.conditions.add({
                        name: "mFound",
                        indicatorColor: UIColors.LIGHT_BLUE,
                        indicatorMethod: ConditionIndicatorMethod.USE_HIGHLIGHT,
                        underlineIndicatorAppearance: ConditionUnderlineIndicatorAppearance.SOLID
    if ( !mOpen) {alert ("Can't open a source file"; exit()};
    mWordsArr = mSource.read().split(mDelimiter);
    len = mWordsArr.length;
    app.findTextPreferences = null;
    while (len-->0) {
              app.findTextPreferences.findWhat = mWordsArr[len];
              mFound = mDoc.findText();
              len1 = mFound.length;
              while (len1-->0)
                        mFound[len1].appliedConditions = [mCond];
    app.findTextPreferences = null;
    How it works (should)?
    Assumed:
    - a list of words to find is in a .txt file as comma-delimited (you could set other delimiter)
    - this file is named 'ID_words_to_find'  and saved in user Documents folder (you can change mPath)
    Script define a condition 'mFound' and apply it to every word from your list found in a document. They are highlighted. You can modify them.
    Notice: to remove a condition (highlight) modify a word including a space before it.
    Enjoy:)
    Jarek

  • With GREP, is there a way to assign a character find/change to a p style?

    I'm looking for more ways to automate text styling in the magazine I produce. In InDesign, I can assign find/replace command strings in the Find/Change GREP window, but I've found no online source that tells me how to find/replace characters using GREP WITHIN a p style. It seems as if the latter GREP capability is limited to changing character styles and can't search and replace actual characters.
    Example: I have a list of recipe ingredients. I want to replace the quantity (one to three digits) at the beginning of each ingredient with a tab-digit(s)-tab combination. In Find/Change, I can enter "\d+\s" and replace with "\t$0\t" but I don't see a way to assign that capability to a p style. I want this find/change to occur automatically any time copy is added to text tagged with the Recipe Ingredients paragraph style, so I don't have to keep running a Find/Change each time we edit the page. One power user has told me it's not possible. Any insight or alternative solution would be much appreciated.

    Your power source has it right, GREP Styles can only apply character styles to the text it finds.
    And there is no easy way to have text replaced automatically -- you would still need to run a script, or press a hotkey or something.

  • [AS] CS3 Find -Change inserting soft return instead of hard

    Can anyone help identify why this script doesn't work? i want it to replace multiple returns with a single paragraph return. It's replacing with a soft return rather than a hard return.
    I copied and pasted the find grep and change grep fields into the script. I even tried it by typing "\r" into the change grep field. Any thoughts? Much appreciated!
    tell application "Adobe InDesign CS3"
    --Clear the find/change preferences.
    set find grep preferences to nothing
    set change grep preferences to nothing
    set find text preferences to nothing
    set change text preferences to nothing
    --Set the find options.
    set include footnotes of find change grep options to false
    set include hidden layers of find change grep options to false
    set include locked layers for find of find change grep options to false
    set include locked stories for find of find change grep options to false
    set include master pages of find change grep options to false
    --delete multiple graphs
    set find what of find grep preferences to "~b~b+"
    set change to of change grep preferences to "
    set myStory to parent story of item 1 of selection
    tell myStory
    set myFoundItems1 to change grep
    end tell
    set find grep preferences to nothing
    set change grep preferences to nothing
    end tell

    Shane, thanks! This worked. What I meant to have written was that when copying "~b" from the find/change field in InDesign and pasting into Script Editor, and saving, it converted it automatically to a hard return. I didn't try it manually because sometimes the obvious is elusive! (to me at least)
    Thanks again.
    Jim

  • CS3 Find/Change Correction

    Fellow Scripters--
    In several places in the Scripting Guide, I set the find/change options to nothing. This is an error. Setting the find/change
    preferences to nothing works; setting find/change
    options to nothing doesn't. It doesn't produce an error message, but it can mess up all subsequent find/change operations.
    The affected objects are:
    AppleScript
    find change text options
    find change grep options
    find change glyph options
    JavaScript
    findChangeTextOptions
    findChangeGrepOptions
    findChangeGlyphOptions
    VBScript
    FindChangeTextOptions
    FindChangeGrepOptions
    FindChangeGlyphOptions
    Do not set any of the above to nothing, NothingEnum.nothing, idNothingEnum.idNothing, null, undefined, or anything similar.
    If you are using the FindChangeByList example script, you might want to remove the lines that do this--I'll get a revised version posted soon. The installed version works fine with the default FindChangeList.txt file, but will cause problems if you try to use more complex grep expressions.
    Thanks,
    Ole

    Here is the version of the script for CS4 (it works in CS3 as well, much better than original CS3 version).
    http://forums.adobe.com/servlet/JiveServlet/download/2080627-12695/FindChangeByListCS4.zip
    You can also use Martin Fisher's script to record settings from Text and GREP tabs, then copy and paste them to FindChandgeList.txt file.
    http://www.kasyan.ho.com.ua/downloads/RecordFindChange_CS3_Kas.zip
    Check out also this script: http://www.kasyan.ho.com.ua/find_change_by_queries.html
    Kasyan

  • ID-CS4 -JS - - Can't find using Grep options - Reg.

    Dear All,
      Here I have a doubt about the "Find / Change Grep" in InDesign CS4.
    I can find the "Force Line Break" using the Grep options : ([a-zA-Z]*)-\\n([a-zA-Z]*)]
    Some time this Grep is working, some time this is not working ...
    I don't know what I made the mistakes. Please let me know any one can suggest and modify the below coding.
    I supposed to close and re-open the InDesign CS4 and ExtendScript tool, then First time this Grep is working fine...
    So I confused this. Please any one can give me a solutions.
    //================= Coding ==================//
       var myDoc=  app.activeDocument;
           app.findChangeGrepOptions.includeFootnotes = false;
           app.findChangeGrepOptions.includeHiddenLayers = false;
           app.findChangeGrepOptions.includeLockedLayersForFind = false;
           app.findChangeGrepOptions.includeLockedStoriesForFind = false;
           app.findChangeGrepOptions.includeMasterPages = false;
           app.findGrepPreferences.findWhat = "([a-zA-Z]*)-\\n([a-zA-Z]*)";
             mySearch = app.findGrep();
             for(var myForce =0; myForce<mySearch.length; myForce++)
              app.select(mySearch[myForce]);
              var mySel = app.selection[0];
               myConts = mySel.contents;
              app.select(mySearch[myForce]);
              var mySel = app.selection[0];
               myConts = mySel.contents;
              app.findGrepPreferences = NothingEnum.nothing;
               app.changeGrepPreferences = NothingEnum.nothing;
    //=============== End of the Coding ========================//
    Please any one can kindly help me....
    Thanks & Regards
    T.R.Harihara SudhaN

    Dear Vaasu Devi,
      Many thanks for your reply...
    I found, where I mistaken....
    Here My Correct Code :
    //================= Coding ==================//
       var myDoc=  app.activeDocument;
           app.findChangeGrepOptions.includeFootnotes = false;
           app.findChangeGrepOptions.includeHiddenLayers = false;
           app.findChangeGrepOptions.includeLockedLayersForFind = false;
           app.findChangeGrepOptions.includeLockedStoriesForFind = false;
           app.findChangeGrepOptions.includeMasterPages = false;
           app.findGrepPreferences.findWhat = "([a-zA-Z]*)-\\n([a-zA-Z]*)";
             mySearch = app.findGrep();
             for(var myForce =0; myForce<mySearch.length; myForce++)
                        app.select(mySearch[myForce]);
                         myConts = mySearch[myForce].contents;
                         $.writeln(myConts);
              app.findGrepPreferences = NothingEnum.nothing;
               app.changeGrepPreferences = NothingEnum.nothing;
    //=============== End of the Coding ========================//
    app.select() is working fine, meanwhile, I get the selection of the contents. That time only its throw the Error message. So I used to divert, app.select and Select Value of Contents to pass the "myConts" variable then I will do the other funtions.... Now My this time I'm not getting the Errors...
    Thanks Once again
    Regards
    T.R.Harihara SudhaN

  • Find/Change HELP

    Hi,
    Anyone know the code for find/change command on text for specific pages?
    Example: I want to change some text from page 20 to 40 -
    Please help

    There is no such code.
    You can select all the text you want and apply your changes to "Selection" only. (Of course you can only select contiguous text -- that is, all of the text frames should belong to a single running story.)

  • GREP 'find/change' by list script: find a text string containing different para styles

    Hi
    I'm don't write scripts but do 'enjoy' copying, pasting and changing existing code/txt files.
    I have built a GREP find/change .txt that performs a large number of text edits/changes.
    But I'm left with an issue where I have paragraphs of text (styled earlier in the .txt file) that I'm unable to identify using GREP the usual way. I need to identify text in a particular paragraph style, followed by text in another paragraph style.
    Is it possible with GREP to create a search string to find: text styled with one paragraph style, ending with a paragraph return, and to include in that selection the following paragraph/s styled with another paragraph style?
    MTIA Steve

    seb400 napisał(-a):
    What do you mean by I would mark "changing" in "copying, pasting and changing"?
    Hi Steve,
    I mean I can see a way by modifying some existing code with "find...change" job
    1. set criteria to findGrep
    2. store findGrep() in an array
    3. check each found object if next paragraph matches some new criteria
    4. run changeGrep() if true
    Jarek

  • Text or GREP find/change method to assign tags

    Hi all
    I could use a text or GREP find/change method to  assign tags to paragraph styles (for use in FindChangeByList), would anyone be able to help please?
    Steve

    Hi Peter
    I produce a quarterly magazine for which text is supplied in Word format.
    I currently run the 'FindChangeByList' script to format body text, headings, bulleted and numbered lists, web and email address text styling and to remove/correct all extraneous characters etc.
    Once the job is printed I need to produce a tagged 'accessible' readable (eg: read out loud function in Acrobat) pdf from the file, for text to speech readers.
    I am currently using the map tags to styles function, which allows me to assign tags which in turn gives me control of the 'text reading' order.
    What I'd like to be able to do is automatically apply the Tags to syles while processing the 'FindChangeByList' script.
    Steve

  • Finished script: Use grep find/change to fill in a supplied table of contents

    This script is now complete, and has been the subject of most of my previous posts. Just in case anyone wanted to know what the finished script ended as, here it is.
    Thanks so much to all. A lot of really helpful folks on this board are very responsible for the success of this task. This script is to be one of hopefully many in the creation of our records. But it's a huge leap forward. Thanks again to everyone that helped.
    Cheers,
    ~Nate
    Task:
    Automatically find town names in listings, and fill in table of contents template on page 2 accordingly.
    Example of page 2 toc, initially:
    Example of a page of content. The town names are what need to be referenced on the TOC:
    Example of page 2 toc once script is finished:
    Because of the need to include the transaction dates on the TOC (comes as a provided, tagged-text file), a simple Indesign-generated TOC can't be used alone.
    This script uses an Indesign-generated TOC that's on a master page called "T-tocGen" ... It then uses grep search and replaces to grab the needed information, and insert it into the page 2 TOC.
    The script will update a generated TOC and then search for an instance of a page number, and town name. The generated toc lists all included towns in the following format:
    (line start)## tab townName(line end)
    In Grep, this would be (please note, extra \ for \d and \t ... javascript needs that for some reason):
    ^\\d+\\t(.*)$
    After the script gets the info it needs from a found instance of the above, it replaces that line with "---", to prevent that line from being picked up once again.
    The script with then place the needed page number in it's rightful place on page 2, replacing the XX.
    A while loop is used to repeat the above process until there are no longer any instances of "^\\d+\\t(.*)$" present.
    Not every town runs every issue, so once the script is done, it removes all remaining instance of "XX" on the page 2 TOC.
    FINAL CODE:
    TOC replace
    This script will use grep find/change methods to apply page numbers in
    tocGen to the XX's on page2TOC.
    // define the text frame of generated TOC
        var tocGenFrame  = document.masterSpreads.item("T-tocGen").pages.item(0).textFrames.item(0);
    // udpate generated TOC ... store contents in tocGenStuff
        var tocGenStuff = updateTOCGen();
    // set variable for while loop
    var okGo = "1";
    // while okGo isn't 0
    while(okGo.length!=0)
    // get town info from tocGen
    getCurrentTown();
    // replace XX's with tocGen info
    replaceTown();
    // grep find ... any remaining towns with page numbers in tocGen?
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "^\\d+\\t(.*)$";
    // set current value of okGo ... with any instances of above grep find in tocGen
    okGo = tocGenFrame.findGrep();   
    // grep find/change all leftover XXs in page2TOC
    app.findGrepPreferences = app.changeGrepPreferences = null;       
    app.findGrepPreferences.findWhat = "^XX\\t";
    app.changeGrepPreferences.changeTo = "\\t";
    app.activeDocument.changeGrep();  
    // clear grep prefs
    app.findGrepPreferences = app.changeGrepPreferences = null;
    //  functions                  //
    function getCurrentTown()
    // grep options   
    app.findChangeGrepOptions.includeLockedLayersForFind = true;
    app.findChangeGrepOptions.includeLockedStoriesForFind = true;
    app.findChangeGrepOptions.includeHiddenLayers = true;
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findChangeGrepOptions.includeFootnotes = true;
    // grep find:  startLine anyDigits tab anyCharacters endLine
          app.findGrepPreferences = app.changeGrepPreferences = null;
          app.findGrepPreferences.findWhat = "^\\d+\\t(.*)$";
    // get grep find results      
    currentGen = tocGenFrame.findGrep();  
    // store grep results content into currentLine
    currentLine = currentGen[0].contents;
    // match to get array of grep found items
    currentMatch = currentGen[0].contents.match("^\\d+\\t(.*)$");
    // second found item is town name, store as currentTown
    currentTown = currentMatch[1];
    // change current line to --- now that data has been grabbed
    // this is because loop will continue as long as the above grep find yields a result
           app.findGrepPreferences.findWhat = "^\\d+\\t"+currentTown+"$";
                  app.changeGrepPreferences.changeTo = "---";
                tocGenFrame.changeGrep(); 
    function replaceTown()
    app.findChangeGrepOptions.includeLockedLayersForFind = true;
    app.findChangeGrepOptions.includeLockedStoriesForFind = true;
    app.findChangeGrepOptions.includeHiddenLayers = true;
    app.findChangeGrepOptions.includeMasterPages = true;
    app.findChangeGrepOptions.includeFootnotes = true;
    // find: XX currentTown .... replace with: currentLine
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.findWhat = "^XX\\t"+currentTown+" \\(";
        app.changeGrepPreferences.changeTo = currentLine+" \(";
    app.activeDocument.changeGrep();   
    function updateTOCGen()
    //set vars ... toc text frame, toc master pag
        var tocGen  = document.masterSpreads.item("T-tocGen").pages.item(0).textFrames.item(0);
        var tocGenPage  = document.masterSpreads.item("T-tocGen").pages.item(0);
    //SELECT the text frame generatedTOC on the master TOC
        tocGen.select();
    //Update Table of Contents by script menu action:
        app.scriptMenuActions.itemByID(71442).invoke();
    //Deselect selection of text frame holding your TOC:
        app.select(null);
    //store contents of toc text frame in variable
        var tocGenText = tocGen.contents;
    //return contents of tocGen
        return tocGenText;

    Thanks for the reply.
    You are correct but the problem is there are three rows, One row is 100% black, the second is 60% black and the third is 40% black. I want to change the black to blue, the 60% black to an orange and the 40% black to a light shaded blue. In the find/change option you can select the tint you want to find and replace but yea.. does work on table cells.. oddly enough.

  • Find/Change words (with GREP) and apply a style...

    I need a Script for Find/Change words with GREP, and apply a paragraph style...
    Thanks...

    Hi Marcos,
    If you want the script to create character styles: Bold , Italic, Bold Italic, etc, and replace local formatting with these styles, use scripts in post #3.
    But if you want find and change words, or/and replace local formatting with styles defined by you, use FindChangeByList script.
    If the latter, I recommend you to download and install Record Find Change script (written by Martin Fisher).
    Then choose settings you need in Find-Change dialog – make sure they work as expected – and run Record Find Change script. A Notepad/TextEdit file will pop up with a line containing the recorded setting. Copy it, open FindChangeList.txt, delete the contents of this file and paste the line you just copied (or add it to the bottom of the file).
    Repeat the process for all find-change operations you need.
    Finally run FindChangeByList.jsx to make all changes in one go.
    However, while using Record Find Change script, you may encounter a problem: it doesn’t record paragraph and character styles placed inside a group. But you can write references to such styles like so:
    appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("Style Group 1"). paragraphStyles.item("Paragraph Style 1")
    Kasyan

  • Path of the Find-Change Queries/Grep folder in ID CC 2014

    Hi,
    Is this var correct to localize the path of the Find-Change Queries/Grep folder in ID CC 2014?
    var query_folder = app.scriptPreferences.scriptsFolder.parent.parent + "/Find-Change Queries/Grep/";
    Thanks in advance! 

    Hello,
    Alert ( app.scriptPreferences.scriptsFolder.parent.parent );
    Mac ID 6, give me this.
    I will have a look at CC later.
    P

  • GREP find/change problem

    Hi, am trying to execute InDesign's default find/change AppleScript script to fix many formatting issues in a large document. One of them is occurences of a two-digit dollar figure followed by a comma (eg. "$10,") that needs to be changed to have no comma.
    Using GREP I can pick it up by finding "\$\d\d," but when I replace it with "\$\d\d" I get the actual string "\$\d\d". IE. "$10," becomes "\$\d\d" rather than "$10". Am I misundersting how the 'change' part of GREP works? Can any one advise?
    FYI the line in the find/change support .txt doc is:
    grep
    {find what:"\\$\\d\\d,"}
    {change to:"\\$\\d\\d"}
    {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false}
    Remove commas after prices.
    ...which includes extra backslashes to escape the backslashes that are part of the GREP expression.
    Any help much appreciated!
    Thanks.

    No, unfortunately lookbehinds don't work with variable-length strings. That's the case with all GREP implemantations, not just InDesign's. You can sort of get around it by using or-constructs, but they soon become unmanageable. Here's an example (split and indented just for clarity, you would need to write all this on one line):
         (?<=\$\d)
         |
         (?<=\$\d\d)
         |
         (?<=\$\d\d\d)
    This one says "if a comma is preceded by $ and a digit OR by $ and two digits OR by $ and three digits, then . . ." As you understand, if you need to allow up to six or seven digits, possibly thousand separators too, then lookbehinds become unpracticable.
    >I'm really struggling to get to grips with how GREP statements work.
    Try this: http://oreilly.com/catalog/9780596156008/
    Peter

Maybe you are looking for