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 code to select number with bracket and next word

Return to Member Forum

  • Author
    Posts
    • #1201842
      Year 1917
      Member

      Hi

      I am looking for a grep code that will select a number with a dot or parentheses brackets etc. after it and the the next word for example “1) first”.
      Thanks

    • #14323598
      Paul Williams
      Participant

      Try:

      \d{1,2}\)\w+|\d{1,2}\.\w+

      Note the brackets around 1,2 should be the curly ones:

    • #14323595
      Year 1917
      Member

      Thanks will try!

      P.s. will this work even with Hebrew letters (instead of numbers it will be Hebrew letters)?

    • #14323594
      Paul Williams
      Participant

      If you want it to work for letters and numbers switch the \d with \w at the front: (the 1,2 checks for numbers with 1 or 2 numbers i.e. 1 or 12 and if you need to cover 3 digit numbers change 1,2 to 1,3)

      \w{1,2}\)\w+|\w{1,2}\.\w+

    • #14323593
      Paul Williams
      Participant

      I’ve simplified the Grep:

      \w{1,2}[\)|\.]\w+

      so that rather than doing 2 searches for a ‘)’ or a ‘.’ it looks for one or the other [\)|\.]

    • #14323585
      Year 1917
      Member

      Thanks Paul!

      Can you also make it that it only selects it, if it’s the beginning of a paragraph?

      Thanks

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