Style GREP in the paragraph style

I am wanting to create a GREP style that uses a character style. Whenever certain words (no classes) appear followed by dates. Sometimes, it's a unique and sometimes more than one date. For example:

No class 7/11.

No class 7/11-8/11.

What I have so far is:

No class \d+.

It works very well through the words 'No class' and the first digit, but not for the whole sentence. I tried different combinations, but nothing works.

Can anyone help?

Jay

The first expression grep in your screenshot does not work because you have added / /, which I should have mentioned should be omitted (including all spaces preceding) - sorry about that. It should read this:

No class\s [-\d /] +.

The hyphen is necessary to match the dates like 7/11-8/11.

As the level of positions with dates and parental guidance optionally, this one works on your example:

\d[-\d\. My] + [my] (, demands. +)?

which is a little more secure that Reese, it's because it requires that the date ends in M or y. The? Suite (, requires) makes between it brackets in option. Remember that grep is case-sensitive: If your months can be tiny m thus, use [-\d\.] MMY] for your character class. You may need to tighten the grep to match the dates according to the formats possible.

Peter

Tags: InDesign

Similar Questions

  • GREP find the paragraph style

    Hi guys,.

    I use this grep to search for all words that use the body text paragraph style.

    However, I get the same result if I specify a paragraph style to find or not.

    The result is always the same. Why is this?

    app.findGrepPreferences = null;

    var found = app.findGrepPreferences.findWhat = "\\b\\w+?\\b";

    found.appliedParagraphStyle = "Body text";

    Found = App.activeDocument.findGrep ();

    Alert ("this document has" + found.length + "words");

    gives the same result as

    app.findGrepPreferences = null;

    var found = app.findGrepPreferences.findWhat = "\\b\\w+?\\b";

    Found = App.activeDocument.findGrep ();

    Alert ("this document has" + found.length + "words");

    app.findGrepPreferences=null;
    var found = app.findGrepPreferences.findWhat="\\b\\w+?\\b";
    app.findGrepPreferences.appliedParagraphStyle=app.activeDocument.paragraphStyleGroups.item("body").paragraphStyles.item("Body text");
    found=app.activeDocument.findGrep();
    alert("This document has "+found.length+" words");
    

    (^/)

  • How to use GREP to apply the character style just for the first and the second line of the paragraph?

    as the title, I just want to ask how to apply the style of character just for the 1st and 2nd line of the paragraph. Help me pls, tks!

    Can you show the screen shot with the invisible market, looks like you feedback after each line.

    So, something like this would work where I have a return forced for the linebreak (shift + return). The example on the right does not work because the line break is a return:

  • Use GREP to apply paragraph styles, character styles not only

    I have a body of text, and in it, I would like to apply a specific style to the paragraphs corresponding to a model. I did a GREP style that applied some changes formatting of paragraphs, I tried that it affects, but in doing so, I found that I couldn't Center these lines using a character style. (The corresponding lines should be centered, and the rest should be left aligned.)

    I was thrilled to learn that the GREP function, then completely disappointed with this limitation. InDesign offers the possibility to automate this, so I must not cross and Center each paragraph corresponding to the hand?

    Thank you!

    InDesign provides a way to automate this so?

    Yes and no. There is no dynamically linked paragraph styles to a paragraph about his boss, but he has at least two alternatives:

    (1) use Grep-F/C

    (2) use the script FindChangeByList or MultiFindChange which is basically automate operations F/C

    HTH

    Loïc

  • GREP find/replace + paragraph Styles

    Hello

    I'm editing a long document and have benefited from the assistance of the community already, but being new GREP Style, find/replace, I need to ask for additional help.

    Below a screenshot of the script (original). Two blocks of text you see anticipated by the icons have have styles of different paragraphs. Icons are placed like custom glyphs.

    Now, the last line with C2, 9, 14,... is the target of this post. They are buses of London and I created a paragraph with another icon. The copy that I work with unfortunately is as you see. Buses will follow «;»

    Resulting to place a \r after the semicolon and assign the new paragraph style. The item to work with is (probably) the last "," before the registration of the bus. All entries have it in the same way, where a search/replace global grep should work fine.

    My attempts:

    I used of a previous debate (? < =------;)) [^ ;] + $ to match everything from the end until the last semicolon, but then I found the problem preserving the matched characters and placing \r (using the (? < =-;). start at the beginning and stops at each point comma + space)

    So question: how to stop at the first semicolon at the end and replace the space with \r to create a new paragraph?

    Then, it is two question :-)

    From my previous attempts, I noticed that when you replace the semicolon + space with \r, and change the style of paragraph at a time (from Rail to Bus) caused the Rail paragraph style change (logic) to the style of Bus. So I tried to say the paragraph style of the track "Following paragraph Style is style of Bus" (and not to change the paragraph style in find/replace), but in a way that no longer works.

    Second question is: given to split the find/replace in two steps, how then transform / apply to newly created paragraph the correct style of Bus?

    Thank you in advance for your valuable assistance. So far, the community has been great!

    Antonio

    Original

    Screen Shot 2016-07-12 at 22.32.23.png

    Result for

    Screen Shot 2016-07-12 at 22.54.51.png

    Hi Antonio,.

    If I understand correctly, in 2 regex [1 click play with Multi/find-replace our friend Martinho da Gloria]:

  • I can target fat with GREP - in dialog paragraph styles?

    Hello.

    I have a number of paragraphs which are mainly "regular" (as the font style: ordinary) but they also have a few bold throughout.

    I'm doing a paragraph style that will apply a character style to text bold using GREP.

    Is there a GREP code for this (to not apply the character for the "BOLD" style and nothing else)?

    I know it's easy to do in the Find/Replace dialog box, but I wonder about the paragraph style dialog box in the GREP section.

    Any help would be greatly appreciated.

    Hello

    Indeed, it is easy to do.

    You do not have to use GREP, you can use the query to search/replace text.

    Start by creating your character for "BOLD" style. (Let's call it "CBold")

    Then create your paragraph style, with your desired settings (let's call it "PReg")

    Finally, click on search it icon 'specify attributes to find', 'Bold' and replace it with character styles and paragraph previously defined:

    Who will do the job.

    Please note that this "erases" all text attributes (for example, italic...) in your paragraph.

    Also, it will apply changes to paragraph all if no style is specified in the search for options: including securities i.e.

    So, be careful when you use this method...

  • Self-propagating ampersands in GREP in a paragraph style

    Hello. I use GREPs in paragraph styles (InDesign CS6) the color of specific words and struck a strange thing, when the words I'm trying to color include an ampersand (&).

    The style works fine the first time, but if I call the paragraph style, and extra sales begins to appear in the GREP expression, not only to the expression, I am changing, but other expressions that include an ampersand as well.

    Example: I enter track ^(?i)------& field

    The next time I have change a grep in this style, the grep goes to the track to ^(?i)------& & field. ^(? (I) then track------& & & field.

    If I go out the extra mostapha, only to see them back. And have a space or not having not spaces on each side of the ampersand does not work

    impact on the problem. I tried to use \s instead of space, but it makes no difference. I also tried dumping my InDesign preferences and export the document as a file .idml in an effort to clear all funky.

    ampersand1.jpgampersand2.jpg

    Has anyone seen this? Thank you!

    Kelly

    Sorry, I have never seen it before.

    A vague assumption: many styles with Grep?

    But maybe you try this instead:

    (? i) a\x e {26}

  • GREP to change paragraph style?

    Many people, I have a one for all what you out there smart people. I think GREP can be used to change the formatting in the next instance, but I have no idea how set up.

    I have a very long document, essentially a telephone directory of type list of names, telephone numbers, addresses, well over 150 pages. Paragraph styles are fairly simple, two only by registration. The name/phone number is "BOLD", with a tab on the right points pointing to a phone number that is aligned to the right of the column. The following lines are at the same level on the left, not fat, but indented 6pts. I placed the text file and assigned the NameListing paragraph style to the whole thing. I would like to use GREP to find lines of addresses and change the paragraph style NameListingAddress.

    Here's a screenshot to give you an idea of screen. The left column is correctly formatted with both styles, the right column is "raw", all paragraphs formatted with the paragraph style NameListing.

    What is an application suitable for GREP? If so, how I set it up to only change paragraphs who "do not have tabs? It would save me a crapload of time.

    Screen shot 2011-11-15 at 8.10.43 AM.png

    THANKS again! -Dina

    The easy way would be to do the reverse of what you're trying: together all the paragraphs of your NameListingAddress style (rather than NameListing). And then do a plain old ordinary search for tabs, do not put anything in the line of "change of...". "(or put another tab in) but the value of change in Format to the NameListing style paragraph in the context menu. Change (after you have checked some of them to make sure it's doing what you want).

    It is probably a way to do this with GREP, but it would be much more difficult.

  • Change the paragraphs found in the standard paragraph style?

    I have look here for about an hour and could not find a discussion for this.  I see where it clears the substitutions but not change Style all together.  Here's what I need help do.  If I left saying text 4 selected boxes, I want the power to change the standard paragraph to paragraph and character set to None style style. If there is already can a discussion that I missed in this regard you point me in that direction.  If this is not the case, can I please help with this.

    You can usetpk1982of script to change all the paragraphs of the standard paragraph. But if you only want the block of selected text, then you will need to adjust thescript to change paragraph styles in the selected text frames.

    basically replace line 2 by var allTFrames = app.selection;
    Also, if you need to clear character styles need to do before you change the paragraph style or character styles will be removed and the formatting will be left as a local override.  Your final script after that these changes would be:

    myDoc var = app.activeDocument;

    var myTFrames = app.selection;

    for (var i = 0; i)< mytframes.length;="" i++)="">

    var tFrame = myTFrames [i];

    pStory var = tFrame.parentStory;

    var allParas = pStory.paragraphs.everyItem ();

    pStory.characters.everyItem () .appliedCharacterStyle = app.activeDocument.characterStyles [0];

    allParas.appliedParagraphStyle = app.activeDocument.paragraphStyles [1];

    }

    Note: instead of simply replacing the 2 wire I also changed the name of the variable to reflect rather than leave it in the form allTFrames; and add line 7... Other than these two changes everything was the script of tpk1982

  • How to insert an ellipsis in the paragraph style?

    Hi all

    In the paragraph style, how to insert the selection to the last paragraph symbol.

    Please someone help me solve this problem.

    I have attached the screenshot of the sample. Like that, I have to insert "selection" symbol (three points) in the indesign paragraph style options.

    ellipse.jpg

    Very simple to do this, follow these steps

    1. double click on the paragraph style if you created (if this isn't the case create a new paragraph style, see the image)

    2. in paragraph style options, choose paragraph nets and do all the settings, see the image

    Hope this will help you

    Thank you

  • Balls, created in the paragraph style options in Indesign

    Hi all

    In the paragraph style, how to create bullets before the text and after the text also.

    Please someone help me solve this problem.

    I have attached the screenshot of the sample. Like that, I must create in indesign paragraph style options.

    Capture.JPG

    Thank you...

  • Change the paragraph by Script Style

    Hello!

    I don't know if this is the right place for this question but since its related to scripting, I'll ask here.

    Is it possible to change the paragraph Styles InDesign with a Script?

    For example, I need set Format1 hyphenation to specific values properties without changing the other properties. For Format2, I need to change other properties such as the Glph scaling.

    Like I need to do this with a lot of files, I suppose that the best way to archive it could be a script.

    Is there someone who had an idea on how to do it?

    Thanks in advance

    Thomas

    You're right, this can be done very effectively with a (relatively) simple script. This is an excerpt from a longer script of mine which covers a changing choice of design of end minutes documents open at once:

    for (i=0; i
    

    For a list of all paragraph properties that you can change, look in the ESTK help or (in a more user-friendly way to read and search) in an online version of these same data: InDesign ExtendScript API (10.0).

  • Graphic object based on the paragraph Style style?

    I just checked the documentation of the API and saw nothing on the point about this.

    Is it possible to write a script that applies a Style object to a jpg image based on the paragraph Style applied to this image jpg online online?

    Hello

    I did the following:

    var curDoc = app.activeDocument;
    
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat= "~a";
    var allFounds = curDoc.findGrep();
    
    for (var i = 0; i < allFounds.length; i++) {
      var curFound = allFounds[i];
      if (curFound.allGraphics.length > 0) {
        var pStyleName = curFound.paragraphs[0].appliedParagraphStyle.name;
        if (pStyleName == "paraStyle") {
          var rect = curFound.rectangles[0];
          rect.appliedObjectStyle = curDoc.objectStyles.itemByName("myStyle");
        }
      }
    }
    

    Kai

  • How to get the paragraph style menu to detach?

    I wish that the paragraph style menu to behave the way the menu character, that is, as its own independent box. Crazy me a little tied to any "other Panel" - no matter what the name of this Panel, it's that it is attached to.

    Thank you very much!

    Just drag it off the coast in the page.

  • [JS] Copy or move the paragraph and character style style

    Hello
    I try to transfer paragraphs a the document to a block a second document but I have hugs the style of paragraph et style character applied.
    I use this command line:


    o.leBlocLegendes.contents = o.leBlocLegendes.contents + leDocument.stories.firstItem().paragraphs[leConteurPara].contents;
    
    


    How do I do not lose anything?

    Thank you


    Original message

    Hello

    I am trying to transfer of the paragraphs in a document to a block of a second document but I loses all the style of paragraph and style of applied character.

    Plug-in this command line:

    o.leBlocLegendes.contents = o.leBlocLegendes.contents + leDocument.stories.firstItem().paragraphs[leConteurPara].contents;
    

    Comment do pay nothing lose?

    Thank you

    Hi Liphou,

    .silence is indeed a property of type string only disregardingly of styles, anchor frames and other animals.

    You prefer the use of object methods and duplicate stories. However styles can be substituted with the target document. If you can load styles before the duplication of the text.

    var main = function() {
        var doc, st, tempDoc, f, tf;
        if (!app.documents.length
            || app.selection.length!=1
            || !app.selection[0].properties.parentStory) {
            alert("You need to select text or text frame");
            return;
        }
    
        doc = app.activeDocument;
    
        if ( !doc.properties.fullName ) {
            alert("Please save file first !");
            return;
        }
    
        st = app.selection[0].parentStory;
        f = File ( doc.fullName );
        tempDoc = app.documents.add();
        tempDoc. importStyles ( ImportFormat.TEXT_STYLES_FORMAT, f, GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE );
    
        tf = tempDoc.textFrames.add();
        st.duplicate(LocationOptions.AT_BEGINNING, tf.insertionPoints[0]);
        tf.fit(FitOptions.FRAME_TO_CONTENT);
    
    }
    
    main();
    

    HTH,

    Loïc

    www.ozalto.com

Maybe you are looking for