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 – find second word in Par

Return to Member Forum

  • Author
    Posts
    • #75082
      Anonymous
      Inactive

      Hi all,

      I need help finding the second word in each paragraph with grep.

      Thanks in advance

    • #75084
      Aaron Troia
      Participant

      That’s a tough one Ohad, there are many variables both before and after both the first and second words to account for, but this is what I came up with so far, it still doesn’t catch every second word but it’s a start.

      ^[^ ]+ \K\w+([’\w]+)?(?=[,])?

    • #75087
      Anonymous
      Inactive

      Hi Ron,
      I basically need to insert an anchored object (which is copied to the clipboard) right before the 3rd word in the paragraph.
      does it make it simpler for you? thanks

    • #75089
      Aaron Troia
      Participant

      Ohad, that does make it easier, I thought you were trying to isolate the second word, but that extra bit of information really helps. So depending on whether you want to place the anchored object before or after the space after the second word,

      before the space:

      Find: ^([^ ]+ [^ ]+)(?= )
      Replace: $1~c

      or after the space:

      Find: ^([^ ]+ [^ ]+ )
      Replace: $1~c

      Let me know if that works or not for you.

    • #75090
      Anonymous
      Inactive

      That works great! Thanks much for your help ++

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