counting in a find change grep

I have a script that runs several find change greps and alert how many each grep search were made.

This is the code:

See section function () {}

app.findGrepPreferences = app.changeGrepPreferences = null;

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

var changed = app.changeGrepPreferences.changeTo = "$1";

Reference of the changed.appliedCharacterStyle = "cross";

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'.");

}

};

No matter how many changes I know she took it returns 1.

It also does not apply the character style to the entire reference. The character style is supposed to underline the Word section \d.

He pointed out only half of the section of Word:

section5

Do not know what is happening.

(1) make sure of course, you have the same name "cross references".

(2) when checking a condition use double ==

If (changes1.length == 1) {and NOT so {(changes1.length = 1)

Tags: InDesign

Similar Questions

  • Find/change Grep can't find one instance per paragraph, where wrong me?

    Hello

    I use a find/change Grep to find any price with a comma and change this comma to a thin space (the newspaper style).

    But the Grep considers only the first instance of this paragraph.

    Example of text...

    "$200 $200 000 000 $200,000."

    text at the beginning of paragraph $200,000

    $200,000 at the end of the paragraph text

    $200,000 tab. »

    In the sample, the grep would miss the second and third prize on the first line.

    I use...

    Find...

    (?<=\$) (\d{3})\,? ({\d{3})

    also tried (\$\d{3})\,? ({\d{3})

    Set up...

    $1 ~ <$ 2

    Is there anything I can add to find these last two prices?

    I use this in combination with script Batch find replace, so different greps are set up for 5, 6 and 7 digits starting by $.

    Thank you.

    Try this,

    (?<>

  • Problem with find/change GREP

    Hi, try to run by default find/replace InDesign AppleScript script to solve many formatting problems 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.

    Use GREP I can pick it up by searching for "\$\d\d", but when I replace it with '\$\d\d' I get the string "\$\d\d". IE. "$ 10" becomes "\$\d\d" instead of "$ 10." I'm misunderstanding how works the part 'change' grep? Can someone advise?

    FYI the line in the search/replace support .txt doc is:

    grep{find what: "-\\d\\d$,"}{change to: "\\$\\d\\d"}{include notes: true, include master pages: true include hidden layers: true, any word: false}Remove commas after the price.

    .. What includes the extra backslashes to escape the backslash which are part of the GREP expression.

    Any help much appreciated!

    Thank you.

    On Grep Pallette, use below syntax to find two or more digit dollar figure followed by a text of commas,

    Search: (\$\d+),

    Change of: $1

    Vandy

  • Find format preferences in a script of find/change GREP?

    Hi all

    I create my first script to search/replace to run GREP queries several at once. But I am struggling to find how to specify the Format to find: preferably in the script that can be in the usual find/replace dialog box.

    Here is an example of a line in my script. What I want to achieve is for the line search for words/characters who currently have [standard paragraph] applied and then change the format of a paragraph style particular, I called "team name"...

    grep {findWhat: "(.+) ', appliedParagraphStyle: '[standard paragraph]'"} {changeTo: '$1', appliedParagraphStyle: 'The team name'} {} / / apply style name team

    BTW, I use the standard FindChangeByList script that comes with Indesign. Any help/comments are appreciated.

    See you soon,.

    Marco

    Instead of the name of the style, try the object of paragraph style:

    grep {findWhat: "(.+)", .paragraphStyles appliedParagraphStyle:app.documents [0] [1] ""} {changeTo: '$1', appliedParagraphStyle: 'new style'} {}

    Peter

  • Of find/change GREP question

    Salvation of the Italy,

    I need to find each "2" in the words "CO2" and apply (only on the ' 2') index style.

    I can't figure out how. If I search all the 2 at the end of a word I also find 2002 and O2, if I find (CO) (2) and replace it with $12 style index applies to the "CO2" not only "2"...

    Can anyone help?

    Luca

    It's a classic: this forum for the shows "CO2 GREP" search this particular application is a good example of Advanced GREP trickery.

    Short version: you want to search for it:

    (?<>

    Read http://forums.adobe.com/message/1285612#1285612 for the long version.

  • Find/change grep

    Hi all

    I need to insert a linebreak forced after the first comma in each paragraph. If the paragraph contains a comma, no problem but if theres more whether inserts all the af or the last (due to the nature of the grep).

    Is there a way to limit the grep for the opener?

    I tried the following:

    app.findGrepPreferences.findWhat = ' (. +?,)';

    app.changeGrepPreferences.changeTo = "$1\n";

    and

    app.findGrepPreferences.findWhat = ' (. +?,) (. +?) [, *])';

    app.changeGrepPreferences.changeTo = "$1\n$ 2 ';

    Hope we can nail; (o)

    --

    molsted

    Search: ^(.+?),

    Change of: $1, \n

    The circumflex accent ^ stands for 'start of paragraph' so he and the lazy operator (as you have already done) combine to restrict the GREP to the first comma only.

    Peter

  • Find/change grep allows you to delete repetitive titles?

    I am new to scripting grep, which saved me a lot of time with the French documents. I would like to delete repetitive titles.

    What I have:

    Education

    -University of Toronto, Toronto, Canada

    Extension to pharma building, 2010

    Role: Project Manager

    Education

    -Concordia University, Montreal, Canada

    Extension, 2009

    Role: Site Construction Manager

    Education

    -McGill University, Montreal, Canada

    Renovations, 1990

    Role: Designer

    What I would like to have:

    Education

    -University of Toronto, Toronto, Canada

    Extension to pharma building, 2010

    Role: Project Manager

    -Concordia University, Montreal, Canada

    Extension, 2009

    Role: Site Construction Manager

    -McGill University, Montreal, Canada

    Renovations, 1990

    Role: Designer

    Hello

    \n is not \r

    So 2 steps. Using like I told [#1 message]:

    + last regex:

    As I've already said, "quickly made operational, but still could be improved!

  • Table of clusters and the cluster is a bar counter, how can I change the color individually?

    Table of clusters and the cluster is a bar counter, how do I change the color of the bar individual meter for each element of the array?  I just realized that you cannot change the properties of an element of the array without changing everything.  For scale, I had to make digital for each graduation of the scale indicators so that each measure meter in the table in the cluster has individual scales.  I also had to do some calculations for each barmeter to display the correct proportions of 0 to 100% on the scale.  Now, I'm stumped on the color of the bar counter.  Basically, if the value exceeds a set value, the meter bar should turn red.  It must be in a table to be infinitely scalable.

    Thank you

    Matt

    And yet anothr approach...

    Right click on the bar of > Options to fill > maximum fill.

    The fill color of the same color as the background color, then make the background color transparent.

    Drop a box of color BEHIND the bar and the size correctly.

    He has this strange background 3D with flat bar, but what the Hey, his relatives. If its important a custom color box.

    Ben

  • 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

  • Urgent need help with find and change / GREP

    I'm working on a manual that contains more than a thousand paintings. I'm not quite familiar with GREP and need help to determine the right to coding/jokers to change the character style to a group of words/numbers on a global basis.

    For example, in Chapter 7, a paragraph style is applied to this line of text:

    TABLE 7.1: T4, T3, FREE T4 AND FREE T4ED

    I need to change "table 7.1:" for a character style and so of suite/so on up to "Table 7,150:"-while leaving the other numbers on the same line unchanged also.»» Is it possible to do without having to manually each table style number?

    gd247 wrote:

    I'm working on a manual that contains more than a thousand paintings. I'm not quite familiar with GREP and need help to determine the right to coding/jokers to change the character style to a group of words/numbers on a global basis.

    For example, in Chapter 7, a paragraph style is applied to this line of text:

    TABLE 7.1: T4, T3, FREE T4 AND FREE T4ED

    I need to change "table 7.1:" for a character style and so of suite/so on up to "Table 7,150:"-while leaving the other numbers on the same line unchanged also.»» Is it possible to do without having to manually each table style number?

    No need for GREP. If "TABLE 7.1:" is text, you can create a nested character style that extends through the colon, in the paragraph style. "

    If "TABLE 7.1:" is created by a numbered list of automatic type paragraph style, you can specify a character style named for the part of automatic numbering in the drop-down menu Style of character, in the Style of numbering of the chips section and numbering of the dialog box Options of paragraph style. If the character style does not exist, you can stay in the operation of paragraph options by choosing 'New Style of character' in the menu. After you create the new style, you're back in the process of definition of the paragraph.

    HTH

    Kind regards

    Peter

    _______________________

    Peter gold

    Know-how ProServices

  • Text or Grep in the Find.change script by list?

    Want to use grep formatting in this request (instead of text), but the script shows the error:

    text {findWhat: ') '} {"changeTo: ')" "} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false}

    Why here coexist two ways of writing?

    How do you decide?

    @Laurent: Hey Hey. After this long history, I always pay attention to the original question...

    Mariana:

    ... because it can combine several characters in a search, for example find a space before the point, period, semi-colon, etc.. Or a space after (or before)...

    Yes, it is possible with GREP. Try this for the first:

    grep {"findWhat:" ([.,: ;])])} "} {changeTo: '$1'} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false} remove the space before the period and al.

    (Don't forget that the script needs TABS between the sections, as in the original file).

    This is a little difficult. In fact, the period is a special character in GREp (it means "any character"), so normally you would need to escape:

    (space).

    to find a space, followed by a period. However, the square brackets [...] define a group of GOLD, and eliminates the magical properties of the time. Apparently, there is no use for a wildcard character in a group! (It would be something like: "the following characters are allowed: a comma, colon, not at all, a semicolon...") »)

    There is a more advanced method to remove the spaces like these. You want to find spaces that are followed by one of these characters and the replacement by anything. It would be

    {"findWhat:" (? = [.,: ;])])} "} {" changeTo: ' '}

    You can try this in the interface to see that it works.

    ---

    The second can be done by using the Unicode value for ellipsis ('\x{2026}' - find a different rating than in ordinary text), or with the special escape code "~ e". Well yes - there is a different escape character. The backslash is used by GREP itself, but GREP does not own InDesign special characters - include page breaks, single chip and double quotes, dash-to-here, cadratins and a few others. They can also be inserted in the menu on the right side of the search field. These characters need a tilde, so InDesign can 'translate' for something that GREP can be used internally, and GREP never sees. As the tilde is nothing special for Javascript, you can safely insert one in the script data file...

    To remove a space before or after an ellipse, you can use this:

    grep {findWhat: '? '} ~ e ? "} {changeTo: ' ~ e '}

    ... but in this case, it may still be easier to stick to the normal text mode (where you would use "^ e" for the suspension points, incidentally).

  • CS3: GREP find/change with the character Style?

    Hello

    Was surfing autour through various resources, but have not been able to understand how / if possible...

    Basically, all along of a wide catalogue, there are a lot of situations with lines of text like this:

    CF2 = Double caramel icing

    and I want to look for this string and apply a character style to just the "CF2" who will be "BOLD".

    Is this possible?

    Thank you!

    Andrew

    Search

    \bCF2 (? == double caramel icing)

    Put your character style "BOLD" in the field of formatting to replace.

    Change all.

  • Find/change the question numbers and create the Table of contents

    Hello! I need help to find all my item numbers and apply a paragraph style so I can use them to create a Table of contents page.

    The sample numbers

    #12345

    #12345-5

    #12345-20

    #12345-ABC

    #12345/N

    I tried to enter #^? ^ ? ^ ? ^ ? ^ ? in the search/replace and but it is exactly 5 characters after the sign #. I wonder if you can find all characters starting by # and up until the last characters.

    Once I found all item numbers, how can I apply the paragraph style to have these characters after the sign #? Because I only want to show item numbers without the # sign on the Table of contents/Index page.

    In addition, I have InDesign CS2, which have no function GREP maybe I can do this without the GREP?

    I really appreciate any help. Thank you very much.

    Are your numbers by themselves in a separate paragraph? OTHERWISE you can not USE the table of contents feature to list all the numbers.

    If are, then just look at # in find/replace, then set it to change formatting a new paragraph style (you must create this style in CS2) that you want to include in the table of contents, then as you say, you can use find/replace once more on the history of the TOC to remove the # of all numbers.

  • Find changes by® and™ symbols

    I would have her find list automatically change® and™ symbols. Someone knows how to do this?

    grep {findWhat: "~ r |"} {"~ d"} {position: Position.SUPERSCRIPT} {includeLockedStoriesForFind:false, includeLockedLayersForFind:false, includeHiddenLayers:false, includeMasterPages:false, includeFootnotes:true}

  • If I change a file name in my ITunes library, iTunes will find changed leadership and play the song?

    I'm trying to back up my iTunes files, but my classical music has too long file names?  If I abbreviate the names of file, iTunes will find these files and play the songs? Also, what is the best way to change a name of file to an album at the same time?

    I'm not as familiar with the Windows platform, but if your main drive and the system supports file names that are long which is why your backup drive? You use a different format on your backup disk?

Maybe you are looking for

  • My iPad2 keeps freezing and does not respond to the touch screen taps or swipes.

    My iPad2 (Version 9.2.1) keeps freezing when I'm online.  It does not meet my touch/slide.  The storage capacity is 12.6 GB, and I have 2.0 GB available. I tried to l ' down and restart, but that doesn't seem to help. This only seems to happen only w

  • Pavilion dm1-4000er: hp pavilion dm1 - 4000er

    Hello! I really want to book 10 windows for free, but windows icon is not displayed at the bottom right. This laptop is perfectly compatible with the required configuration: windows 7 service pack 1, 4 GB of ram. So what's the problem? I don't really

  • KB2572073 security update is to repeatedly download and installation

    HelloKB2572073 security update is to repeatedly download and installation. When I check on Windows Update reports installed successfully. How can I fix it?

  • SBH52 don't make phone calls after the installation of Marshmallow

    Hello I upgraded my Z3C Marshmallow Android and since then, the SBH52 does not allow me to make phone calls from the call log. I had similar behavior original lollipop but discovered "Call Log Smart Extras" had to be installed and the problem solved.

  • SMARTnet to asa5505

    I recently bought an unlimited user ASA5505 for domestic use and it will come with the latest firmware/software?  (I bought it froma amazon). Also I am looking for the purchase of smartnet for this device, I need support replacement of the device (re