4 Replies Latest reply on Jul 21, 2014 2:36 AM by Steve_BDL

    Grep to style second occurrence of a word

    Steve_BDL

      Hi All,

       

      I am currently setting a dictionary for children.

       

      bicycle noun

      a vehicle with two wheels in tandem, usually propelled by pedals connected to the rear wheel by a chain, and having handlebars for steering and a saddlelike seat. • Some find it quicker to ride a bicycle  and weave through the cars than to take the bus or drive a private vehicle.

       

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

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

       

      bicycle noun

      a vehicle with two wheels in tandem, usually propelled by pedals connected to the rear wheel by a chain, and having handlebars for steering and a saddlelike seat. • Some find it quicker to ride a bicycle  and weave through the cars than to take the bus or drive a private vehicle.

       

      This grep (as is) is working as expected across all the dictionary but now I need to be able to select only the second word (italicized and in red in the example above) to be able to give it the correct character style.

       

      Any assistance would be greatly appreciated.

       

      Many thanks in advance.

      Stephen