GREP STYLE, find/change

Hi!
My problem is..
I got these numbers:
17
31.9
32.9
15
in a table/cells. They need to have an .00 and 0 like this:
17.00
31.90
32.90
15.00
I can use this one for that: find: .$  change: $0.00 but then the numbers with 31.9 gets the .00 also.. 31.9.00
Any grep styles for that? multiple functions in the same style`?

A grep style can't change text for you; it can only apply a style to text that matches whatever pattern you set.
I don't think there any one search/replace that will get you where you want to go, but I was able to do it using two search and replace strings:
^\d+(?!\.)\b
$0.00
Finds any number of digits at the beginning of a line, that does NOT have a period following it, and returns the same number with ".00" appended.
^\d+\.\d\b
$00
Finds the remaining instances that have a period and only one digit after it, replaces it with the found text with "0" appended.
This will not touch anything that has a number that has two digits after the period, like 12.95.
Give it a try on a copy of your document, see if it does what you need. Depending on how your document is set up, and what other text is in it, you might also want to highlight the table (or just the relevant columns) and restrict the search to the selection rather than the whole document.

Similar Messages

  • Using GREP styles for changing characters and colors

    Hello everybody,
    I have a question regarding GREP styles. I wish to change each letter of an alphabet in text to a square in a different color. For example: every 'a' in the text change to a yellow ■. I thought GREP styles would be perfect for it so I went to find/change, typed in my requests and InDesign told me it has found no 'a' in my text, which isn't possible. How do I fix it? And the other thing- is it possible to change the color of ■ ? Because i couldn't find the option.
    Please excuse me my incompetence, I am a new user of InDesign.
    Thanks in advance for your help! : )

    First off, it sounds like you want to use find/change with GREP, which is fine, rather than a GREP style, which is part of a paragraph style definition and cannot change the text in any way other than apply a character style to the found string, so would not help here.
    The not finding the text makes me think you've limited the search parameters in some way, either by limiting the scope to a selection, or by including a style or format requirement in the find options, perhaps.
    In order to do this, I think you are going to need to make use of the "other" category in the change dropdown and select Formatted Contents of Clipboard (which should clue you in that you need to make one of your colored squares and copy it to the clipboard before you run Find/Change). You can do this with either a plain text query or a GREP query, and there is no advantage to GREP in this case unless you want to match several different things and apply the same clipboard content to any of them.
    You'll need to run a separate find/change for each colored square. It might be possible to script a chain so it runs in a single operation, but that would also require swapping the colored sqaures on the clipboard which complicates things in this case. You might want to ask over in scripting: InDesign Scripting

  • GREP Styles and Changing Ligatures

    Hello,
    I have been using InDesign since it came out, and have great results. However, I am brand new to GREP, and was wondering if a script could be made/written(?) by me (a person who does not understand script), to do the following:
    I have tons of copy, regularly, with a number of different ligatures in it. One (of the many, the fi ligature) causes the client to cringe. Is it possible to change this ligature by - turning off - the fi ligature only? Because I am out of the old school, I appreciate ligatures, and tight kerning.
    I realize, I could just turn off ligatures, but, would rather not.
    Thank you,
    Lain Kennedy

    A character style whose only property is no ligature, used as a GREP nested paragraph style, is certainly the best approach. However, if the ligature appears in many different paragraph styles, it might be possible to change them all in one operation by creating a paragraph style that duplicates (not based on) [No Style] - that is with no properties set - and create a GREP nested style for it that applies the no ligature property to fi. Then set each paragraph style to be based on this no-fi-ligature paragraph style.
    I haven't tested this to see if this really works. Character styles are supposed to supersede paragraph styles, but perhaps not in this scenario.
    HTH
    Regards,
    Peter Gold
    KnowHow ProServices

  • Formatting text with GREP or find/change

    Hi,
    Is there a quick find/changesearch or a GREP that I can use to format all the text that is inside a pair of pipes? For example "|Gone with the Wind|" would then be italicized.
    I have over a hundred pages of text that has been placed inside these pipes, and had Microsoft Word find/replace to format them, but can't seem to figure out how to do it in InDesign.
    thanks in advance,
    Lina

    If the pipes are not to be deleted - in this case GREP is not the best way. Try nested style instead:
    Have fun

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

    Would like to use the grep formating in this query (instead of text) but the script shows error:
    text {findWhat:" )"} {changeTo:")"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
    Why here coexist two ways of writing?
    How to decide?

    @Laurent: heh heh. After that long story I was still paying attention to the original question...
    Mariana:
    ... as this can combine more characters in a search, for example finding space before point, period, semicolon, etc. Or space after ( or before)...
    Yes, that's possible with GREP. Try this for the first one:
    grep {findWhat:" ([.,:;])"} {changeTo:"$1"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Remove space before period et al.
    (Remember the script needs TABS between the sections, as in the original file.)
    This one is a bit challenging. Actually, the period is a special character in GREp (it stands for "any character"), so normally you would need to escape it:
    (space)\.
    to search for a space followed by a period. However, the square brackets [...] define an OR group, and that removes the magic properties from the period. Apparently, there is no use for a wildcard character in an OR group! (That would be something like, "The following characters are allowed: a comma, a colon, any at all, a semi-colon ...")
    There is a more advanced way to remove spaces like these. You want to look for spaces which are followed by any of these characters, and replace them with nothing. That would be
    {findWhat:" (?=[.,:;])"} {changeTo:""}
    You can try this in the interface to see it works.
    The second can be done using the Unicode value for an ellipsis ("\x{2026}" -- another notation than in the regular Text find), or with the special escape code "~e". Yup -- there is another escape character. The backslash is used by GREP itself, but GREP does not understand InDesign's own special characters -- page breaks, smart single and double quotes, Indent-To-Here, em dashes, and a few others. They can also be inserted from the menu on the right side of the Find field. These characters need a tilde, so InDesign can "translate" them internally to something GREP can use, and GREP never sees them. Since the tilde is nothing special for Javascript, you can safely insert only one in the script data file ...
    To remove a space before or after an ellipsis, you could use this:
    grep {findWhat:" ?~e ?"} {changeTo:"~e"}
    ... but in this case it may again be simpler to stick to regular text mode (where you would use "^e" for the ellipsis, by the way).

  • Use Grep Styles to add multiplication symbol.

    Hey Everyone,
    Has anyone used grep styles to change 5x6 to 5×6?  I tried to do it, but the dialog box to create a grep style is the character style dialog box. But, I am unable to enter a glyph. Now, I can use the find and search for \d+x\d+, but it will find 5x6 and change it all to × instead of changing the "x" only. I would hate to have to search for "x" in a document. Just trying to find a way to change "number 'x' number" to "number '×' number."
    Thanks,

    Or you can use (?<=\d)x(?=\d)  [that's a look-behind/lookahead withthe x in the middle] and apply a character style to scale and shift the x. GREP styles cannot change the glyph used, only the formatting.

  • 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

  • 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

  • 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

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

  • JS:CS3 Newbie needs help! find/change character styles

    I'm new to scripting and JavaScript is giving me a headache, but I'll keep trying. What I'm trying to do is automate a few things so that the production time of our school newspaper is reduced while insuring accuracy.
    I've played around a little with the text find change sample and the changing or adding paragraph styles in the InDesignCS3_ScriptingGuide_JS.pdf and I barely understand what I'm doing.
    When us page designers receive text to place in the document, our editors mark the text with tags like: < b >text< / b >, where the word "text" is to be bolded. (there wouldn't any spaces between < and b and > etc. I just did that so It'll show up here). We have basic character styles and paragraph styles set up, and we just started working with nested styles.
    Is there a way we can search for the < b > tag and bold everything after it up until the < / b > tag? Sort of the way it does for html (the way it would do for this message if I took out the spaces). It'll be great if it could remove the tags as well, but if not, I know I could create a find/change script to do the removal afterwards.
    I appreciate any input.
    Thanks!

    You've not found yourself the easiest of tasks! You need GREP find/replace, not text. Do you have any experience with GREP? It's worth investigating, it's a powerful feature. The script below handles bold. For clarity, it doesn't do any error checking: it assumes that there's a document with text in it and that the document contains a character style called 'bold'.
    // talk to Indesign, nobody else
    #target indesign
    // reset the Find/Change dialog
    app.findGrepPreferences = app.changeGrepPreferences = null;
    // find everything between <b> and  (including these codes)
    app.findGrepPreferences.findWhat = '<b>.+?</b>';
    // add 'bold' style
    app.changeGrepPreferences.appliedCharacterStyle = 'bold';
    // make the changes
    app.activeDocument.changeGrep();
    // now delete the <b> and </b> codes
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = '</?b>';
    app.changeGrep();
    You can adapt it easily to handle other codes, and at a later stage you could generalise it so that you needn't repeat whole bunches of code.
    Good luck with your first forays. Again, it's not the easiest of tasks, but it's worth getting to grips with.
    Peter

  • 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 - Applying Paragraph Style

    Hello,
    I used FIND/CHANGE to apply my paragraph style and when I apply the paragraph style... it applies the style to the entire line.
    For example,
    A. #70712       resulted to         A. #70712
    I only wanted the "#70712" to be changed to my style. I used the GREP search and entered #.+ and then I choose the paragraph style I want and clicked change all. The problem is that it changed all the text on that line and applied the paragraph style.
    Please help. Thank you very much.

    graphicsoc wrote:
    Hello,
    I used FIND/CHANGE to apply my paragraph style and when I apply the paragraph style... it applies the style to the entire line.
    For example,
    A. #70712       resulted to         A. #70712
    I only wanted the "#70712" to be changed to my style. I used the GREP search and entered #.+ and then I choose the paragraph style I want and clicked change all. The problem is that it changed all the text on that line and applied the paragraph style.
    Please help. Thank you very much.
    If I understand your request correctly:
    If your paragraph style uses a numbered list to create the "A." and the remainder of the paragraph consists of only "# 70712" that you type in manually (or place from an existing file), I believe that you you don't need GREP. You can format the auto-numbered list differently from the remainder of its paragraph, by specifying a character style for the number portion.
    To extract only the non-numbered portion of an auto-numbered paragraph, for a TOC, in the Table of Contents dialog box, open the bottom part by clicking More Options if necessary, and in the Numbered Paragraphs pull-down menu, select Exclude Numbers.
    Read more about Table of Contents in Help, and/or with a Google search for terms like "InDesign table of contents numbered list exclude numbers" without quotes.
    If you need additional special formatting "tricks" in the source paragraphs, or in the TOC entry paragraphs, look into Nested Styles and GREP
    Styles in Help or Google searches.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • Why not there a "Find/replace in Grep style" inside the Para style?

    Whenever I type a digit in my text, it should be colored red as per style. I do this by grep style inside the para style, but now I need to insert brackets before and after of the digit(s), i realize that there is no replace option in grep style in the para style. Why not it be there a "find/replace" instead "find" only as it now appears?

    Ya, this is simple, finding a specific para style with digit and change them, when the book in first pass. But while in the correction pass of the same book, whenever we are inserting more text into the document, there are chances to be unaware of the digit style that, it should be surrounded by brackets, and it happened earlier so I have a thought of it. Again, while paginating a book having more than 350 - 600 pages, and 3 to 4 guys working in it, I think this may work.
    Expecting your valuable comment on this.
    Thangaraj Mohan.

  • 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

Maybe you are looking for