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]:

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

    (^/)

  • Find and replace paragraph styles?

    Hi all

    I'm building a desktop, Tablet and phone layouts for a site.  What is the the faster/more easier way to change between layouts paragraph styles?  Is there a way find and replace paragraph styles?  If I copy / paste the contents of the desktop version to the version of the Tablet, and I've set up styles for each layout, how to change styles without manually changing each iteration of the style?

    Example: I paragraph title book BookHdr styles and BookHdrTablet is it possible for me to automate changing all instances of BookHdr in BookHdrTablet?

    Thank you very much, Barbara

    There is no way to override the styles heavily; You can, however, change the styles of multiple objects by shift-click to select.

    David

  • InDesign CC Grep find/replace to replace the character of space per paragraph (fly)

    Hello InDesigners,

    I'm trying to clean up a 99 page document. In the file, titles of chapters, in capital letters, followed by a space, which is then followed with text more uppercase there. This always occurs at the beginning of a paragraph.

    I'm trying to target the space character that appears just after the number of chapter and Exchange to a number (fly).

    For example:


    CHAPTER 22 SUNDAY UNDERGROUND

    I want the Grep to change this as follows:

    CHAPTER 22

    SUNDAY UNDERGROUND

    I know that to do this job, I need to use positive look behind and positive Look Ahead, at first, I just tried to isolate CHAPTER 22 using the following:

    ^ \u{2,}\s\d+

    It worked. However, as soon as I cut and paste into P.L.B., find/replace says that it does not match.

    (?<=^\u{2,}\s\d+)\s


    The culprit seems to be the comma that comes just after the number 2. If I take, I get a match, but just not the one I wanted.


    Why P.L.B. does not accept the comma as part of the range in my definition grep?


    (FYI, I prefer to use wildcards with a specified scope, rather than literal text).

    It is indeed the comma, and the reason why it does not work because the flavor of InDesign's GREP does not allow a variable length argument in its lookbehinds. And the construction "has {x, y}" indicates a variable length.

    "Chapter" only you know how many characters to uppercase, and even the exact text, you can use

    (?<=^CHAPTER>

    the first chapters to a number, then

    (?<=^CHAPTER>

    for the rest. In your version of InDesign, I guess there is also a possible solution with the fairly new \K "forget - me" operator but I have not yet enough experience with that. It should look like this:

    ^ \u{2,}\s\d+\K\s

    but you will have to experiment a bit to see how to work with the replacement string.

    In addition, you should only use the name of "fly" for a character that looks like this: "¶". The code that you insert will call it a 'return' or 'paragraph return. Initially, I took your question literally, and it sounded as if you were after this result: "CHAPTER 22 ¶ SUNDAY UNDERGROUND"

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

  • Cannot find the paragraph style, which is apparently in use

    Hello.

    I'm working on a document with the text that I have imported the word. After you have applied all my character and paragraph styles, I check to see if there are styles original Word still in use. Can I do a search/replace for those still persistent and change them to mine. There is a paragraph style, named normal, what don't get me. It seems to be in use - when I try to remove it, he asks what style should be used to replace it. It shows also upward on the Panel of cross references when I try to create a new cross reference. I tried to change its definitions to something with the big guy and a strong color, so I could find it easily on the pages, but not luck. When I use find/replace to the style, I get the message "cannot find match". I even tried the police search of the style, I do not use on my styles, but nothing appears. Am I missing something?

    Thank you.

    The next thing to try would be exporting to IDML. See remove minor corruption by exporting

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

  • 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

  • Find/replace paragraph shading

    I have a project submitted by a designer and somehow most of the paragraphs have a + after the style and it's because the shading of the paragraph has been changed. No paragraph shading is turned on everywhere, so I would like to get rid of all the + s, but I don't see a way to search and replace paragraph shading.

    Hello

    By Javascript!

    See: Re: what are the paragraph properties that control the new paragraph shading option in CC2015?

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

  • Cannot find the paragraph styles

    When I create a table, the text style sometimes as "Table Style 2" in paragraph styles section but but when I click on the triangle to the list of different styles, he is nowhere to be seen. "" I'm new on this so sorry if it's something obvious but is there more models on the list of those that appear immediately and if yes how do for them?

    Using Pages on El Capitan 10.11.1 v5.6.1. When I insert a new table, the Table Style 2 paragraph Style is visible in the text: Style tab. Click on the triangle produces a rollout with the list of paragraph Styles. I can't reproduce the problem you describe.

  • GREP: Find several paragraphs in square brackets

    Attempts to write a grep which finds the text, including paragraph breaks, bracketed tags [EXT.] and [/EXT].  It looks like this:

    Int hillestisite militam dolupta corera seque nonsers perrum aut aut aut por and and man re dolut dolorio

    [EXT] m doluptae dolorem idebit pa dolendit, optassi mendae optam labor sita consecum

    New era, its dolessim rehenisquam conem etum nihil con pos eatem odit ratis orenim and inveni officati undi reium faccae dolupti acienetur ipistio. Pienistecae n [/EXT]

    [EXT] onsed and aliciae plabor aut mos that tem nobis Theon denihil latusantin anagement recte explaborem ent quist, solest, omniendaecto bersperro dolest, sam autatur, tiossit ab imuscia epernature and alitatuscia volupta volene who niendant that not only

    atiassit, and dolent of res ditati pa, cum estis eatempo rerovid nis volecu elenis

    mquam quo eumet quis voles dollantium dolupta a doloriori officilis mintior entini quo eost my ea doluptiorro unt quidi

    quibus one and fugiatibus excepuditi utecus moditatem atemoditia doluptat dolum haecceity consequ cus res doluptibus arum fu [/EXT]

    GA. Nam quis minullor adignita soluptias Abdellatif sit quam quis am vendiciis alit eliq ero

    Here's my formula:

    \[Ext](.+\r.+)+-[/EXT]

    It is the second set of brackets, with several paragraph breaks, but you won't find the first game, one with only a single paragraph break.

    Any ideas?

    Thank you!

    It's as simple as the last one.

    Try this:

    \[EXT\][^\]]+\[\/EXT\]
    

    Hope that helps.

    --

    Marijan (tomaxxi)

    http://tomaxxi.com

  • 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

  • A question of character grep find/replace script

    Hello

    I'm changing the FindChangeList.txt on javascript in indesign cs4 to allow me to automate some grep commands, but we have a problem: in indeisgn if I use the search/replace tool, it works fine, but it doesn't work on the script.

    is what I'm trying to change all instances of + (plus) in a document ± but it seems that the script is read as "nothing more nothing, how to recognize the + as a symbol rather than as a command?

    the line that I use in my code is as follows:

    grep {findWhat: '+'} {changeTo: '±'} {includeMasterPages:true, includeHiddenLayers:true, includeFootnotes:true, wholeWord:false}

    Thank you

    Try {findWhat: "\ +"}

  • Find/replace style cell with GREP

    Hi all, (my first post here)

    I found a script very useful on this forum to find/replace cell styles in an array. I adapted the script using Peter Kahrel ebook for use with a GREP query.

    I've linked to a spreadsheet in InDesign CC 2014 I want to highlight the cell of new products that contain the value [Y].

    When I run the script below, I get random results.

    myDoc = app.activeDocument var

    app.findGrepPreferences = app.changeGrepPreferences = null

    app.findGrepPreferences.findWhat = "\[\u\"]

    var myFound = myDoc.findGrep)

    for (i = 0; i < myFound.length; i ++)

    {

    If (. parent.constructor.name myFound [i] == "Cell")

    {

    . parent.appliedCellStyle myFound [i] = "New_Product_Cell".

    }

    }

    Modify the script that I wrote above.

    Otherwise your discovery is just '[u]' ==> multi-ad found is--> Direct manufacturer name


    Jarek

Maybe you are looking for