#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    3
    Rep Power
    0

    Do I use some kind of backtrace here?


    I need some help with a long list of text for a index. It is formatted as described below.

    I want to find the first line that is bold below (a line without a tab?). And copy that line to each other line until the next line without a tab ... (See example below =)

    FROM THIS:

    HU11
    Rebecca Magnusson\t14
    Linn Samuelsson\t3
    Lova Lundin\t22
    MP1A
    Magnus Axelsson\t16
    Rune Bergström\t4

    TO THIS:

    HU11\tRebecca Magnusson\t14
    HU11\tLinn Samuelsson\t3
    HU11\tLova Lundin\t22
    MP1A\tMagnus Axelsson\t16
    MP1A\tRune Bergström\t4

    InDesign can use GREP in find and change and take advantage of back reference \1 \2 etc.

    Is this possible to do in one big search? I have several pages of the above described text block.
  2. #2
  3. Jealous Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,302
    Rep Power
    9400
    Can't do it with just a regular expression. It would need some kind of loop somewhere.

    Though that loop may be you clicking a button. Fix the Rebecca line manually and see if
    Code:
    ^(([^\n\r\t]+)$\s+)(([^\n\r\t]+\t[^\n\r\t]+\t[^\n\r\t]+$\s+)*)([^\n\r\t]+\t[^\n\r\t]+$)
    replaced with
    Code:
    \1\3\2\t\4
    works. It may have to cycle through the document a few times before it replaces everything.

IMN logo majestic logo threadwatch logo seochat tools logo