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

GREP match digits up to first column

Return to Forums

  • Author
    Posts
    • #53571
      Anonymous
      Inactive

      Hello,
      I need to underline every digit positioned before the first column in a paragraph.

      Example:
      The number 10 in this intro translates to: 826.

      10 has to be underlined 826 not.

      How is this possible with GREP Styles?

      Thanks

    • #53575
      David Blatner
      Keymaster

      Not sure what you mean by “before the first column”
      You might be able to do this easily with nested styles… such as “no style up to the first digit” then your underline style up to a space. Would that work?

    • #53576
      Anonymous
      Inactive

      I meant “up to the first column (:)”
      Each digit from the beginning of a paragraph up to the first column character has to be underlined.

      All digits written before the first column character have to be underlined in the following examples.

      This 12 is 34 the 567 first: example 1234599
      Here is 0987 another 111: example 0192836

    • #53577
      Anonymous
      Inactive

      I think the word you are looking for is colon. A column is “one of two or more vertical sections of a printed page separated by a rule or blank space”. Since that is also a design word, that’s probably why David was confused.

      \d+(?=.*:)

      This should find everything leading up to a colon, but be aware that if there are more than one colon per line, it will include all the numbers that precede the final colon.

    • #53578
      Anonymous
      Inactive

      Thanks jessereko.

      Oops, yes of course, colon (probably reminded me a little too much of our body part).

      I am using ^(.+?): to get all characters bold up to and including the first colon,

      but \d+(?=.*:) does not stop at the first colon. Like you pointed out, every digit in the paragraph gets underlined up to the final colon.

    • #53579
      Anonymous
      Inactive

      If you could figure out a character that would stop the search, for example if there is a period at the end of every sentence, such as:

      The number 10 in this intro translates to: 826. This 12 is 34 the 567 first: example 1234599. Here is 0987 another 111: example 0192836.

      \d+(?=[^.]*:)

      This will find any digits followed by any string of characters that isn’t a period, then a colon. or if you could find a similar character that interrupts the pattern you could substitute that for the . in the square brackets.

    • #53583
      Anonymous
      Inactive

      Yes, that is much better!

      The period is a good marker, but could pose a problem in case that the first period is in front of the first colon.
      Example:
      Here we have 2345 digits, i.e. 10 times more than: 23 pieces of cake.

      What is the reason that makes it so hard to stop the search at the first colon?

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