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 3 Characters or less

Return to Member Forum

  • Author
    Posts
    • #14363937
      Nathan Rule
      Participant

      I am using this grep code However i want it to only do 4 characters or less and leave anything in parentheses more then 4 alone.

      (?<=\().*?(?=\))

      What would be the right way to do that?

    • #14363940
      David Blatner
      Keymaster

      Check out the “Wildcards” section here:

      Favorite GREP Expressions You Can Use

      The curly braces indicates how many you want. For example, .{3} means three of any character. \d{3,5} means there should be between 3 and 5 digits.

      • #14363941
        Nathan Rule
        Participant

        I thought i read that link. So in this case i would change it to be

        (?<=\(){1,2,3}(?=\))

        EDIT: That doesnt work, (?<=\().(?=\)) that finds exactly 1 or (?<=\()..(?=\)) finds exactly 2 but .,.. Doesnt find anything

    • #14363950
      Dhafir Photo
      Participant

      Use this: (?<=\().{1,4}(?=\))

      • #14363952
        Nathan Rule
        Participant

        That doesnt work either. Thanks though!

      • #14363953
        David Blatner
        Keymaster

        Dhafir’s code works great for me. This finds everything inside parentheses that has between 1 and 4 characters. Are you sure you’re using curly-braces? (?<=\().{1,3}(?=\))

      • #14363955
        Nathan Rule
        Participant

        im copying and pasting…Yours worked fine. Not sure why it didn’t work with his.

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