Apply grep style only once

I can't get my brain around what is probably a very simple problem: I want a paragraph style that applies boldfacing to any character up to an including the first colon in a paragraph. If I used  a nested style "through 1 :" the whole graf is bold if there is no colon. So that's out.
A grep style ".+: " seems to work in most cases, but if there's a second colon, the boldfacing is extended to that point. What I think I want is a grep style that works "zero or 1 times" but I cannot figure out how to use the ? to make that happen.

@Jongware – I think Robert wants to limit the GREP style to the first line of a paragraph.
But unfortunately GREP in InDesign does not know about line endings.
In scripting we could do something like what he wants, but comes with some obstacles, because the GREP will apply a character style, that will probably change the line ending. A very dynamic situation…
Example 1
Basic situation:
This is my text here comes the colon: and
here another one: that Robert don't like
to take into account using the GREP style.
Formatted after  the GREP style is applied:
This is my text here comes the colon: and
here another one: that Robert don't like
to take into account using the GREP style.
As I understand it, in case that the first colon will leave line one, only the first line should be formatted like this:
(Case 1)
This is my text here comes the first
colon: and here another one: that
Robert don't like to take into account
using the GREP style.
Or should it be, that the style should only be applied, if it's in the first line?
(Case 2):
This is my text here comes the first
colon: and here another one: that
Robert don't like to take into account
using the GREP style.
But what, if the colon in the basic case is at the end of line 1 and will be shifted to line 2 after formatting?
What should happen then?
That is simply not possible to format automatically (dynamically) using GREP styles in InDesign.
Uwe

Similar Messages

  • Applying a style only to selected text

    In the latest version of Pages is there anyway to apply a style only to selected text and not to whole paragraph? Thanks.

    Yes, use Character Styles.
    Peter

  • Apply GREP style to part of the expression

    How do you apply a GREP style to only part of an expression... for example if I wanted to only apply styles to numbers followed by a letter "m".
    m\d+
    This will format both the m and the numbers... how do I get it to target parts of the expression?

    You have to use a positive lookahead…
    It must be \d+(?=m)

  • How to apply TD style only to cells in one particular table

    The "schedtable" class below is applied to a nested table,
    but my syntax for
    the TD applies the rule to the outer table cells as well.
    What would the correct syntax be to limit the rule to only
    the cells in the
    "schedtable"
    Please take a look -
    <style type="text/css">
    <!--
    .schedtable {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-variant: small-caps;
    line-height: 2em;
    border-collapse: collapse;
    .td {
    padding-left: 10px;
    border-bottom-style: inset;
    border-bottom-color: #FF0000;
    border-bottom-width: 1px;
    Thanks

    I owe you one more Os,
    much appreciated.
    "Osgood" <[email protected]> wrote in
    message
    news:fp4fr0$7dq$[email protected]..
    > Ken Binney wrote:
    >> The "schedtable" class below is applied to a nested
    table, but my syntax
    >> for the TD applies the rule to the outer table cells
    as well.
    >> What would the correct syntax be to limit the rule
    to only the cells in
    >> the "schedtable"
    >>
    >> Please take a look -
    >>
    >> <style type="text/css">
    >> <!--
    >> .schedtable {
    >> font-family: Arial, Helvetica, sans-serif;
    >> font-size: 11px;
    >> font-variant: small-caps;
    >> line-height: 2em;
    >> border-collapse: collapse;
    >> }
    >> .td {
    >> padding-left: 10px;
    >> border-bottom-style: inset;
    >> border-bottom-color: #FF0000;
    >> border-bottom-width: 1px;
    >> }
    >
    >
    >
    > .schedtable td {
    > Blah: Blah;
    > }

  • Inserting a special character with GREP styles

    Hi.
    I wanna define a GREP style that makes this: if I write Bluetooth I wanna that a registered trademark is added at the end of the word but with superscript format. Is it possible?
    Thanks in advance.

    No, GREP styles only apply formatting, they cannot insert characters. Use a regular find & change to do so.
    (There is a thinking-outside-of-the-box solution. If you have access to a font creating utility, you can create a character 'h' with TM attached to it. Then you can use a GREP style to automatically apply this custom font to just the 'h' of 'Bluetooth'. See http://indesignsecrets.com/insert-a-special-character-with-grep-styles.php.)

  • Transition executed only once in a TableRow

    h1. SCENARIO
    h3. Model
    /* Model is a Person containing a flag active */
    class Person {
       private Boolean active = false;
       /* more fields and methods */
    h3. View
    /* The View is implemented in FXML */
    class View extends TableView<Person> {  }-----
    h3. Service backend
    class Service implements Observable {
       public void run(){
          Person person = new Person();
          person.setActive( Math.random() > 0.5 ? true : false );
          setChanged();
          notifyObservers(person);
    h3. AS IS ViewController
    /* ViewController observes the service which sends back Person with a randomly changed flag [true or false] */
    class ViewController implements Observer {
    TableView table;
    public void initialize(URL url, ResourceBundle rb){
    /* some code before */
    /* Implemented with datafx library */
    table.setRowFactory(new Callback<TableView<Person>, TableRow<Person>>() {
                @Override
                public TableRow<Person> call(TableView<Person> p) {
                    final CSSTableRow rowCell = new CSSTableRow() {
                        @Override
                        public void getCssState(List s) {
                            super.getCssState(s);
                            if(getItem() == null || s == null){
                                return;
                            if ( !((Person) getItem()).isActive() ) {
                                s.add("active");
                                FadeTransition fadeTransition = FadeTransitionBuilder.create()
                                        .duration(Duration.seconds(2))
                                        .node(this)
                                        .fromValue(0.1)
                                        .toValue(1)
                                        .build();
                                fadeTransition.play();
                    rowCell.getStyleClass().add("table-row");
                    return rowCell;
    /* some code after */
    }h4. Main Problem in AS-IS:
    <font color="green" face="courier" size="3"> The animation animates for every event occurs in the table (click on a row, hover on a row and so on) </font>
    h3. WANNA BE ViewController
    <font color="blue" face="courier" size="3">
    <li>Apply the transition when the service sends the updated Person.</li>
    <li>Apply the transition to the row which this person belongs to.</li>
    </font>
    class ViewController implements Observer {
        public void update(Observable obj, Object message) {
            if (message instanceof Person) {
                Person p = (Person) message;
    /* ----> 1. Find the row of this current person sent by service */
    /* ----> 2. Apply the transition only once in the row found */
    }Edited by: valerio.massa on 29-ago-2012 2.51

    I just dont want to raise the animation via rowfactory, is that possible?
    I would like to find a "better" (stylish) way to launch the animation (for example in the update(){} method, which is better theoretically speaking)

  • How can I apply a GREP style to a text variable?

    Hello everybody,
    I have a question concerning GREP styles inside Paragraph styles.
    1. I've created a text variable to generate a recurring title on the upper side of the page based on the main title paragraph style;
    2. The recurring title is in Adobe Garamond Small Caps, all letters in lower case, and it is formatted with a paragraph style sheet in the master page;
    3. I want to create a GREP style for the recurring title, according to which every time that in the recurring title appear an apostrophe or the double quotes, they are automatically lowered 2pt on the baseline
    (I already created the character style sheet that lowers letters of 2pt).
    What I need is the correct GREP formula to automatically apply the character style sheet to apostrophes and double quotes, in the line of text generated by the text variable...
    Thanks for your  help
    p.

    Hi,
    As I said, using Power Headers is the best way to do it.
    As Power Headers treats the header as "live text", you can use a simple grep style inserted in the header para style:
    … to obtain:
    For the sample, I use a char style named "-2pts" with Shift -5 pts and Green color to show you the place of ' and ".
    Don't forget that, even Power Headers treats the header as "live text", you only have to update Power Headers to make an update of the headers! 
    Even I use in another cases Tomaxxi's [JS] and it's a good way to treat the question, Jean-Claude Tremblay's solution is less interesting because the variable used is converted in text. If the variable text content changes, it's more complicated to manage the update!

  • How do I apply a grep style to the plus (+) sign?

    I was able to apply a grep style to the minus and equal sign, but not the plus sign "+".  It appears the plus sign means 'apply to all' in the grep style box.  Can some assist me with this? Thanks in advance.

    Thank you. It worked perfectly.

  • Apply certain css styles only when JS is enabled?

    I'm wondering if there's a relatively simple way to apply certain CSS styles only when JavaScript is enabled in the browser (and thus, not applied when JS is disabled)... I've created a jQuery-based image gallery, and I'd like to modify how it degrades by selectively disabling certain CSS styles...
    thanks for any direction here.

    Hi
    As your jQuery image gallery would not work correctly if javascript was disabled,. The better approach would be to enable the required css styles using jQuery, (the title says this, but your post says the opposite).
    To do this see the jQuery documentation regarding css, at -http://api.jquery.com/css/.
    PZ

  • Script for applying object style to only tif, or eps or...(by extension)

    We need to apply object style to only eps files in doc, or tif.... How to do this? Maybe someone have a script?
    thanks

    @kajzica – I don't have a script for that, but it is scriptable. You surely mean that you want to apply the object styles to the container frame of the images, aren't you?
    A few minutes later – try the following ExtendScript (JavaScript) code:
    You could edit the names of the two object styles at the beginning of the script code.
    OR: you could first run the script, the script will add two object styles to the document that you can edit afterwards.
    The script will sort the EPS and the TIFs from the other image types.
    Make sure that all graphics are up-to-date and linked correctly!!
    //ApplyObjectStylesTo_ContainersOf_TIF_EPS.jsx
    //Uwe Laubender
    * @@@BUILDINFO@@@ ApplyObjectStylesTo_ContainersOf_TIF_EPS.jsx !Version! Thu Dec 12 2013 13:15:30 GMT+0100
    //Edit your style names here. Change the name between the two " " only!!
    //OR: edit your object styles in InDesign after running the script.
    var styleNameForEPS = "EPS-Containers-Only";
    var styleNameForTIF = "TIF-Containers-Only";
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
    app.doScript(_ApplyObjectStylesToContainers, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT, "Apply object styles to containers for TIF and EPS graphics");
    function _ApplyObjectStylesToContainers(){
    var d=app.documents[0];
    var allGraphicsArray = d.allGraphics;
    if(!d.objectStyles.itemByName(styleNameForEPS).isValid){
        d.objectStyles.add({name:styleNameForEPS});
    if(!d.objectStyles.itemByName(styleNameForTIF).isValid){
        d.objectStyles.add({name:styleNameForTIF});
    for(var n=0;n<allGraphicsArray.length;n++){
        //The EPS case:
        if(allGraphicsArray[n].getElements()[0].constructor.name === "EPS"){
            allGraphicsArray[n].parent.appliedObjectStyle = d.objectStyles.itemByName(styleNameForEPS);
        //The TIF case
        if(allGraphicsArray[n].getElements()[0].constructor.name === "Image" && allGraphicsArray[n].getElements()[0].imageTypeName === "TIFF"){
            allGraphicsArray[n].parent.appliedObjectStyle = d.objectStyles.itemByName(styleNameForTIF);
    }; //END: function _ApplyObjectStylesToContainers()
    Uwe

  • IDCS5/MAC - GREP Style to uppercase a letter after a dash between words

    G'day there.
    I'm trying to create a GREP style to uppercase a letter after a dash between words, more specifically where one word starts with a capital and the one after a dash does not e.g. Lorem-ipsum = Lorem-Ipsum
    The full story is that there is a standing indesign file used over and over again which data-merges surnames which are in a massive database. The data arrives in uppercase and our mail barcoding software allows us to Title Case certain fields, but the Title Case behaviour has the following results:
    * McLeod = Mcleod
    * D'Agostino = D'agostino
    * Smith-Bunting = Smith-bunting
    i've been able to solve the McLeod = Mcleod problem with the following GREP style:
    (?<=Mc)\l
    and then apply a character style which is nothing more than All Caps.
    similarly, i've been able to solve the D'Agostino = D'agostino problem:
    (?<=\u')\l
    and once again apply the All Caps style to the affected letter. This also solves the O'leary problem to O'Leary.
    However, when I try these GREPs to grab the Smith-bunting style issues:
    (?<=\u\l+?-)\l     or   (?<=\u\l{2,}-)\l
    the search won't work, nor will it work with regular Find/Change GREP replace... yet the expression \u\l+?-\l will find the block that i'm after.
    I could use the search
    (?<=\l-)\l
    and this will find Smith-bunting = Smith-Bunting... but will also find co-operate = co-Operate (will find two words joined with a dash but  starts with a lower case letter).
    This is fine if the para style is applied to the  line in the address block containing the client's name, but if the name is referred to in a block of text, then that block of text has to have the para style with the GREP style applied, and any dashes between words in that para behave the same way as the name.
    yes, it is possible to go into excel and use the =PROPER(affected cell) and fix the Smith-Bunting fields, but i'm trying to create a solution which will work solely in InDesign so that other operators in the office (who aren't familiar with excel) can simply open the standing file and dump in the txt database generated by the mail barcoding software.
    there are other names that the mail barcoding's title-case fouls up i.e.
    * MacLeod = Macleod
    * van der Graaf = Van Der Graaf
    * van Diemen = Van Diemen
    but a GREP to make Macleod become MacLeod may foul up Mack, Mackie or Macy to become MacK, MacKie or MacY.
    I also know that a GREP for the van der or van won't work as the style will only force letters to become All Caps, not uppercase to lower...
    Ultimately...
    does anyone know a way to GREP style (not a find/change GREP) a fix for Xxxxx-xxxxx = Xxxxx-Xxxxx?
    Colly
    Colecandoo.

    I agree with Haakenlid on his Dirty-Workaround view -- I feel data should be entered the way it oguht to, not altered by some magic GREP styling -- but then again I can also sympathize with your POV re: a fire-and-forget solution even your dumbest operator can't miss.
    Oh the rigors of life.
    If you are totally, absolutely certain you want to do this by GREP, use this:
    (a) Set a To Capitals character style to the string
    \b\u\l+\-\l
    -- this will magically transform "Hon. Lt. Sir John Forsythe Blunt-object" into "BLUNT-Object".
    (b) Then override ( ! ) the first half again with another character style that removes the To Capitals attribute ( ! ):
    \b\u\l+-(?=\l)
    Notice how this expression is exactly the same as the above one, except for the very last code -- the next lowercase must also be caught, but now using a lookahead so its formatting won't be affected.
    This removes the All Caps override from the first halve, changing it from "BLUNT-Object" back to "Blunt-Object".
    Lots of side effects, I'm sure. Perhaps it is safer to teach your operators to run a single script.

  • A GREP style not holding in CS4

    Hi,
    OK...I have been playing with a bunch of these GREP searches in CS4 where I can put them in as a stylesheet.
    I have a character style that is called superscript, that automatically makes a ® superscript when it is typed, and that is working fine.
    Then I added my lookahead for any TM or ® to add a 100 tracking in between the letter and the tm or ®. It does it if I have the type in the box and apply my style to the whole box. But, if I go in and make changes to the text, the ®-superscript automatically happens when I type a new one, but the tracking doesn't automatically happen. What's worse is, if I select the text and try to apply the style manually, it still doesn't not apply the 100 tracking. I have to make it a basic or none style and then re-apply the good one.
    If it is in the GREP style of the paragraph style, shouldn't it do it dynamically?
    Here is my image.
    thanks!!
    babs

    The only object I know of you can create an InDesign and specify whether it prints or not in the PDF is a button. That would definitely NOT work with character styles.

  • 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

  • Finding MANUALLY applied character styles

    Hi all,
    We're in the process of switching to an XML workflow, and as one of our interim steps we're applying tags to paragraph and character styles in some of our documents. I'm aware of the option to map styles to tags and this should work well for paragraph styles. However, we're looking for a way to only map the character styles that have been manually applied.
    As an example, we have a paragraph style for instructions that has a bold number nested at the beginning of each paragraph. In other places, the same character style may be used to bold a specific word, but it is applied manually. Is it possible to map to tags ONLY the character styles that were applied manually? We do not want tags identifying character styles that were applied via Nested Styles or GREP Styles.
    I am assuming this would take some sort of script, which is why I'm posting in the scripting forum. Does anyone know if this is possible?
    Thanks in advance,
    Matthew

    Another InDesign oddity!
    If you fill a frame full of placeholder text and assign a "Bold" character style to, for example, a Nested Style:1 word, and a GREP style \<\w{4,6}\>, then use regular (or GREP) Find Text to search for the character style, it'll only highlight words that are at the start of the paragraph. Now that is wrong, wrong, wrong, because
    (a) it should not find any of them -- if you click your cursor into one of these bolded words, the Character Style panel says it's [None].
    or
    (b) it should find all of them, not just those that happen to be at the start of a paragraph. (BTW -- it's not the Nested Style it picks up; when using only GREP styles it'll also find words-at-the-start).
    It is funny, if things like this tickle you, that in a script "findText" works exactly the same. However: if you 'found' bold text and then interrogate what character style it has applied, it will only return your "bold" style if it was applied manually.
    See this script -- test with a placeholder text, aforementioned Nested/GREP styles, and a few hand-picked words that you applied "bold" to yourself. It will only report the ones you marked.
    app.findTextPreferences = null;
    app.findTextPreferences.appliedCharacterStyle = "bold";
    list = app.activeDocument.findText();
    r = [];
    while (list.length)
         next = list.pop();
         if (next.appliedCharacterStyle == app.activeDocument.characterStyles.item("bold"))
              r.push (next.contents);
    alert (r.join("\r"));

  • How to apply multiple styles for nested tags in XML?

    Say you import this XML into InDesign:
    <Root>
      <strong>
        <em>Bolded and Italicized</em>
      </strong>
    </Root>
    And you have two character styles, bold and italics, to map to strong and em tags respectively.
    You will see that the text appears italicized not bolded and italicized as expected. Generally, only the innermost tag will get the style and will overwrite its parent styles.
    Notice the XML is generated dynamically and tags order is not enforced. Also, there's an additional underline tag that can be nested with these two.
    So far I have tried to use GREP styles (with paragraph styles), but these do not have effect in the XML tags.
    Other possible options not tried yet:
    Create new tags for every formatting combination. Not what I really want because I could en up with a lot of tags each one with a corresponding styles.
    Create InDesign XML rules to apply character styles automatically based on the tags
    Use character styles in the XML with the aid namespace referencing InDesign styles. Will this really work?
    What do you suggest to go for? See any other option?
    Thank you in advance.
    Juan

    I'd say that you should create tags not for appearances, but for semantic content. Specifying formatting styles in your XML betrays your lack of familiarity with the format, because the last thing you'd want to do would be to use HTML markup in the middle of your XML. If you have content that's supposed to be both bolface and oblique - say, a warning - then it's marked up as
    <warning>Never refer directly to formatting in your XML markup, only to content types!</warning>
    If I had a document that was written in the style you suggest - one with lots of overlapping local formatting - I'd look at developing a better style guide that told the writers that doing so would be bad form. Because, you know, many of the writers I deal with are addicted to forms of emphasis that do nothing useful whatsover for their readership - they only serve to overemphasize the authorial voice of the writers.
    Maybe you could tell us why you need these overlapping forms of styling, and we could suggest other InDesign formatting tools (like line styles or nested styles) that would help you get the appearance you want without crowding styling markup into your XML - where, strictly speaking, it doesn't really belong.

Maybe you are looking for

  • Printing PDF Error from Acrobat Reader on Firefox

    Hi all ! I have a website, that can generate PDF Files. Recently, when I generate a PDF from Firefox, and the PDF file is a bit large (like 18MB or 30MB), I can't print if from Firefox. The fact is that the preview of the PDF is shown correctly by Ad

  • BW/BI WAD Templates are not appearing in the Enterprise Portal.

    Hi Experts We have executed BW/BI WAD Templates in the portal but they are not getting displayed where as if we execute BEx Queries its running successfully.Could anybody help us in solving the issue. Regards, Piyush S

  • 2 different reactions in the BPEL console under 'Sensorwerte'

    A) After looking the same BPEL instance I get 2 different outputs : a) f.i. things like sensor definitions : SensorAction_ASV_Entw      Aktiviert?      Namen veröffentlichen      Typ der Veröffentlichung      Ziel der Veröffentlichung      Sensoren  

  • CVI- activeX

    I have started looking at and working through the Active X examples (e.g. 3DGraphAxis). The CA_ functions are included in the CVI help documentation but the CW3D__ functions not. 1) What is the best way to get to know the ActiveX controls (working th

  • Small network, two VLANs, need some guidance

    Hello. Big-time newbie here. I have a Cisco 2801 router and a few Cisco SG200-26 switches. I need to configure two VLANs: vlan10 for public wifi access and vlan20 for private staff use. I have fa0/0 configured with IP 192.168.1.2/24. This interface w