Grep for styling the second occurrence of a Word

Hi all

I'm putting a dictionary for children.

name of the bicycle

a vehicle with two wheels in tandem, usually propelled by pedals attached to the rear wheel by a chain and have the handlebars for steering and a saddlelike seat. • Some find it faster to ride a bicycle and weaving through cars to take the bus or drive a private car.

I managed to match the first occurrence of the bicycle to the second (underlined below) using the following grep.

(?:^( \w+).+\r.+(\r.+)?) (\1)

bike noun

a vehicle with two wheels in tandem, usually propelled by pedals attached to the rear wheel by a chain and having the steering handlebars and a seat saddlelike. • some found it quicker to mount a bike and weaving through cars to take the bus or drive a private vehicle.

This grep (that which) works as expected in the dictionary, but now I need to be able to select only the second word (in italics and in red in the example above) to be able to give him the correct character style.

Any help would be greatly appreciated.

Thanks in advance.

Stephen

GOAL!

Tags: InDesign

Similar Questions

  • Add the signature field to the second occurrence of two words (nieme Word) on the page


    I have a script that searches for two words ("APP ENG") on a page and adds a digital signature field.

    The trick is that there are two occurrences of these words and place the script in the field of digital signature on the first ocurrance of the two words.


    I need the digital signature script to add to the second occurrence of these two words.

    There was a counter added the script, but this place then the field on the word ("ENG"), it might have to do with the meter to count one word instead of two.


    If someone can help me to modify the script to count the words and the occurrences of two words instead of one word it would be most appreciated.

    Script as follows:


    var ckWords; pair of words to test

    var number = 0;

    numWords = this.getPageNumWords (0); number of words on the page

    loop through the words on the page

    for (var j = 0; j < numWords-1; j ++) {}

    get the pair of words to test

    ckWords = this.getPageNthWord (0, j) + ' ' + this.getPageNthWord (0, j + 1); test words

    If (ckWords == "ENG APP") {}

    Count += 1;

    If (count == 2) {}

    var q = this.getPageNthWordQuads (0, j);

    convert quads in the rotation by default user space

    Userspace used by links

    m = (new Matrix2D).fromRotated(this,0);

    mInv = m.invert)

    r = mInv.transform (q)

    r = r.ToString)

    r = r.split(",");

    var m = this.addField ("EngSignature", "signature", 0,

    ([r [0], [1] r, r [2], r [5]]) ;

    }

    }

    }

    Thank you.

    You must use the left coordinates of the first table and the right of the second table.

  • How can I add a style "BOLD" grep on the first occurrence of a Word?

    Hi all

    I need help on adding a style "BOLD" grep on the first occurrence of a Word.

    I can add the "BOLD" to the word, but it adds to all occurrences, see below:

    GREP style (Incorrect)

    Apply Style: "BOLD"

    Text: \ < Lorem Ipsum\ >

    Nam Lorem Ipsum semper pellentesque tincidunt. UT nisi sit amet arcu nulla tristique dictum. SED commodo total non mauris cursus pretium. Lorem Ipsum Aliquam erat volutpat. Morbi id pretium justo. Nam lorem quis facilisis molestie risus fermentum. Vestibule ut sem elit. Nunc eget neque Sed elementum augue EU outbound.

    I need only the "BOLD" to add to the first occurrence of the word, as below:

    Nam Lorem Ipsum semper pellentesque tincidunt. UT nisi sit amet arcu nulla tristique dictum. SED commodo total non mauris cursus pretium. Lorem Ipsum Aliquam erat volutpat. Morbi id pretium justo. Nam lorem quis facilisis molestie risus fermentum. Vestibule ut sem elit. Nunc eget neque Sed elementum augue EU outbound.


    Thanks in advance for the help!

    This should do it for you

    Apply style

    "BOLD"

    text (? i) ^(.+?) Lorem Ipsum

    apply the stye

    Book

    text: ^. * ? (? = Lorem Ipsum)

    The first expression search all the text from the beginning of the parapgrah through the Lorem Ipsum

    The other defines the rest of the text before the Lorem Ipsum to the base style (book, novel, or whatever your basic style)

  • Firefox please add a webkit for styling the div overflow scroll bars? Chrome has and they spend you upward.

    Firefox still leaves us the div overflow style scroll bars. Chrome and they are passing firefox upward! Do you think that one day before I got to the old code, they will add a webkit for styling the div overflow scroll bars?

    I see this question is about 7 years old I saw first, he asked in 2005

    Hello, this is a mainly managed by the community support forum is probably not the right place for the characteristics of the request (we are unable to implement all the features & devs read here).

    Please use https://input.mozilla.org/feedback for either your reactions or if you think that it is a missing feature in the browser file a bug at bugzilla.mozilla.org.

  • Find the first occurrence of a Word

    I have a script which detects and counts all occurrences of a Word.

    I need the script to find the FIRST occurrence of a Word only.

    Can any advise please how do I change the script to find the first occurrence of the word?

    Script as follows:

    {

    numWords = this.getPageNumWords var (0);

    for (var i = 0; i < numWords; i ++)

    {

    var ckWord = this.getPageNthWord(0,i);

    If (ckWord is 'MATERIAL')

    {

    / * Script going here based on the finds the first occurrence of the word 'MATTER ' * /.

    }

    }

    }

    I tried var CKWord = this.getPageNthWord (0,0); but reports from the rear console is UNDEFINED?

    numWords = this.getPageNumWords var (0);

    var number = 0;

    for (var i = 0; i)
    var ckWord = this.getPageNthWord(0,i);
    If (ckWord == "ISSUED") {}
    Count ++;
    If (count == 2) {}
    var = this.mouseX Coord.

    var annot = this.addAnnot({)
    page: 0.
    type: "Stamp."
    name: "AppStamp."
    Rect: [coord + 1000, 2300, 30, 2820]
    rotation: 90,.
    ({AP: '#C94cHAFFa42U1gTH5Tug5C'});
               
    break;
    / * this.flattenPages (); */
    }
    }
    }

  • Replace the last occurrence of a word in a string

    Hello

    I need to replace the last occurrence of a word in the string. Example of form:

    "I like fruits and vegetables as" need to replace the last occurrence of 'like' that is just before the vegetables and not 'as' before the fruit.

    Something like that!

    SELECT
        REGEXP_REPLACE('I like fruits and also like vegetables','like','hate',1,2) data_col
    FROM dual;
    
  • srchdata in subforms does not not for the second occurrence

    Hi all

    Probably a very simple answer, but hoping someone can help us

    We have xml in the format below:

    < saList >

    <>adjustment

    < adjList >

    < totAmt > - 50.00 < / totAmt >

    < / adjList >

    < / setting >

    < / saList >

    < saList >

    <>adjustment

    < adjList >

    < totAmt > - 12.00 < / totAmt >

    < / adjList >

    < / setting >

    < / saList >

    I have a subform that is triggered on the adjustment of <>and in the sections which subform that trigger on < adjList >. So, we get two parts with the above XML code.

    In this section, I have a DAL which is changing the value of < totAmt > above, remove the '-' if exists and substituting a "CR" at the end (e.g. 50.00 CR / 12.00 CR).

    The SRCHDATA for this is in the format:

    TPAAMT = SrchData ("!") ("/ xxxxxxxx, saList, adjustment, adjList [* @GETIMAGE *] / totAmt", 1.19)

    The DAL works for the first triggered section, but returns EMPTY for the second triggered section. Any other information is removed from the second incident, but the DAL does not work. Can anyone help?

    Thank you

    Patrick

    As you currently described the data you get two data items by using the xpath expression that you mentioned earlier. However, you will not get a third.

    Assuming that the repetition of node at the top level is not relevant for your situation of subform, you dumb down to the xpath expression to be less precise.

    TPAAMT = SrchData ("!") ("adjList [* @GETIMAGE *] / totAmt", 1.19)

    By doing so, you say you want to find any occurrence descendant of adjList, regardless of his filiation. If you include the line above the relevant node, then it is considered important for research.

  • Problem with GREP - find only the 1st occurrence

    Hi all

    In the example below, I'm trying to find the text between pairs of characters $ .

    1.png

    Theoretically, it should work - \$\s.+?\s\$ - but in practice, he finds that the 1st instance. I can't understand why.

    It is interesting in JS, this phrase works as expected.
    I select text and run the script:

    Main();
    
    function Main() {
        var doc = app.activeDocument;
        var sel = app.selection[0];
        var contents = sel.contents;
        var match = contents.match(/\$\s.+?\s\$/g);
    }
    

    And it returns all occurrences of four:

    2.png

    What I am doing wrong?

    Thanks in advance.


    Kas

    We could improvements, adds Adobe InDesign GREP and now the character $ gets a little hackneyed. He did likewise for me (only find 1 here), but I got it to work using

    \x24\s.+\s\x24

    (where "\x24" is the hexadecimal representation of "$").

  • GREP for changing the style of paragraphs ending with '='

    Hi, I work with a giant list of the names and dates of graduation. Each line ends with a space and an equal sign must have a special paragraph applied to her style. Is it possible to design a "find/replace" for this, instead of manually? I can't understand what would work the GREP search string - I've never worked with him before, and I can't find anything in the lists of the metacharacters that would do the trick. Any ideas?

    In find it on the field just type = $ ( means hit the bar to type a space). The $ at the end means the end of a paragraph, so he could find no instance anywere elsewhere in a paragraph, which is the only reason why you have to GREP for that instead of a search of plain text.

    Set the paragraph style that you need in the form of the change.

    It works only if it IS indeed the end of a paragraph, however. If you have several lines in the same paragraph that ends with =, or more text in the paragraph after the =, you need to show us the structure. Don't forget that the paragraphs can have style single paragraph, applied to the whole paragraph. If you need several styles in the same paragraph, you need to use character styles, which can be applied as nested styles, line styles and GREP styles, or manually, depending on the structure of the text, you have to work with.

  • HP Pavilion 510n - adding the Second hard drive?

    A few questions...

    1. is there a size limit for any player second, I would like to add?

    2. What is the procedure for adding the second disc?

    -J' added a second drive to an OLD pc before and it involved linking the second slot on an IDE cable, change the jumper on the slave drive settings, and modify the bios settings... it would be similar?

    Hello TSobiech, it is always best to ask to order a part that is not compatible with a certain system.

    The hard disk that you show the link should work perfectly. Even if it's an ATA100, and your system supports ATA33/66, this disc should still work but will be downclocked to ATA66 speed.

    Here is another link to a 250 GB IDE HDD if you might be interested.

    You won't notice much, if any, degradation in performance to the difference in speed. These IDE drives are higher than the price a SATA with the same capacity, but they are becoming harder to find.

    Since you want to be using as operating in car system, but just a backup drive, they want to make a difference.

    If you want to make use of the full speed of ATA100, you could add a map of IDE controller supporting ATA100, but I really don't think it would.

    Since you mentioned the intermediate layer of IDE as not being used, you can connect the new drive to this connector.

    Now, there are a few things that you should check that you install the new hard drive. These are the connectors of jumper on hard drives.

    This is the very small plastic with metal inserts, at the end of the hard drive where are the other connectors.

    I always use the CSEL (CS) on two hard drives. Readers may already have jumpers to this setting (jumpers connection), but if not, you must set two hard drives the selection of cables (CS).

    Since the current IDE hard drive is the boot hard drive and an ATA66, it must be connected to thin ribbon cable connector, as it is now, and the new hard drive attached to the middle connector IDE. The slowest speed of the two hard drives will result in two hard drives running at the slower of the two speeds. It will work very well.

    You need to partition and format the new hard disk before it can be used. This can be done from Windows if necessary.

    I hope this helps.

  • queryNew type date and time specific only to the second?

    I create a game or an application using queryNew() split a query longer into related parts.  One of the fields in the larger query is a date-time filed with millisecond data that relate to proplerly sort records.  Apparently, the queryNew() function time and date data types are accurate for only the second and is to truncate the necessary data from Ms.

    First question is possible to change this behavior and have the date of queryNew() and | or data types time be more accurate.

    Oh, and I am a muppet. Use 'timestamp' data type.

  • When I use HDMI to connect my macbook to the TV - it lights for a few seconds, then disappears?

    When I use HDMI to connect my macbook to the TV - it lights for a few seconds, then disappears?

    I tried all 4 HDMI ports

    my computer is 2013 macbook pro retina - tv is a 1 year old samsung

    Try this support article > use your TV as a monitor

    If you have an Apple TV, you can use AirPlay to the screen of your Mac on the TV via HDMI.

  • It shows the logo, but is not on even a while it does, but for only 2 seconds then shows new logo

    It shows the logo, but is not on even a while it does, but for only 2 seconds then shows new logo

    Hello

    Follow the instructions here, including contacting Apple Support or your Genius Bar reservation if necessary:

    If your iPhone, iPad or iPod touch won't turn on - Apple Support

  • Firefox will not open even for a split second, shows the page to update norton toolbar in this time and closes before I can even click on anything whatsoever

    Firefox refuses to stay open for half a second. I deleted everything regarding Firefox on my computer, have run Norton Power erasers, am running a full system scan, and even tried to see if Norton was blocking it somehow. I don't know if it's some sort of error, processing, because the last time it worked he asked to update to firefox, and then he said that it was not compatible with the norton toolbar. After update, it crashes like this. I have re-installed many times off my internet, checked the Task Manager and nothing. I have no idea.

    System: Windows 7 32 bit, running on an eMachines computer. Never had this problem before.

    I actually ran it as administrator and it seemed to invite firefox finally to do whatever the heck he was doing. Thanks for the help!

  • For the second time in two months, all my messages in the Inbox are not there. Only the SUBJECT and the FROM is left. Tried to 'fix this folder' and lost ALL

    For the second time in two months, all my messages in the Inbox are not there. Only the SUBJECT and the FROM is left.

    Tried to 'fix this folder' and ALL - lost ALL the Inbox.

    The file is still there and works well...

    How can I stop it and what are the causes?

    Thank you all, Gabe

    If you have the file somewhere on your hard drive, export and import tools it will be important back to Thunderbird.

    https://addons.Mozilla.org/en-us/Thunderbird/addon/ImportExportTools/

    Instructions http://chrisramsden.vfast.co.uk/3_How_to_install_Add-ons_in_Thunderbird.html

Maybe you are looking for