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 command that finds the character after or before a word or character(s)

Return to Member Forum

  • Author
    Posts
    • #113758
      Anonymous
      Inactive

      Struggling with this one.

      Want to find a grep command that finds the character before or after a phrase or character. for example: it finds character before elect. So if i write “Select” it will apply a character style to the “S” in select. Or i want to find the character after “.space” or “:space” or “;space” so i can apply a character style to the letter at the start of a sentence.

      Chris

    • #113761
      Aaron Troia
      Participant

      Hey Chris,

      Based on your punctuation example, this should work for that: (?:\.|,|;)\K\w

      With the \K there is no capture group, so your replace field I believe you would use $0 which just replaces whatever is found with itself.

      Aaron

    • #113763
      Anonymous
      Inactive

      Thanks a lot Aaron. You really helped me out!

      Still curious if its possible to find the character before a phrase. This way i can apply a character style to the first character of a predetermined word. In my project i need the word “enhance” to always start with a capital “E”. So if i there is a command that finds the character before “nhance” i would be able to do that.

      Chris

    • #113768
      Aaron Troia
      Participant

      oh good! Yes it is possible to find the first character of a predetermined word, try

      e(?=nhance)

    • #113770
      Anonymous
      Inactive

      Nice, thanks again!

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