Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Using GREP to Remove Unwanted Data from line …

Return to Member Forum

  • Author
    Posts
    • #60887
      gamouning
      Member

      Hi,

      I have a set of numbers that are tab-delimited and I wish to remove any data which surrounds the part I want to keep. For example my data looks like this:

      1-2 3-4 5-6 7-8 9-10

      9-6 4-10 2-7 5-1 8-3

      1-6 4-7 9-2 5-3 8-10

      10-7 4-9 6-3 8-1 2-5

      7-6 5-4 10-1 3-9 2-8

      1-9 7-3 10-5 6-2 4-8

      The part I want to keep from each line above should appear as follows:

      7-8
      8-3
      8-10
      8-1
      2-8
      4-8

      I came up with the following GREP code which locates the set of numbers I want to keep.

      d+(-8)|8(-d+)

      Is there any way to strip away the data that is surrounding my sequence of numbers using GREP?

      Thanks in advance for you help!

    • #60888

      Uh, so you want to delete all number combinations except when they contain an '8', right? Then the simplest solution is not to use d to search for all digits but make a set of your own:

      t*b1?[0-79]-1?[0-79]b[ t]*

    • #60889
      gamouning
      Member

      Hi Jong,

      Yep, just what I needed. This GREP works perfectly! Thanks. :)

Viewing 2 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads