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

Literal Period (.) Find Between

Return to Member Forum

  • Author
    Posts
    • #63353
      Anonymous
      Inactive

      Hi all,

      I have this format:

      Project Title:(en space)A bunch of characters—which is the name of the project (and ending in a PERIOD followed by a carriage return)

      I want to delete the periods at the end of of the project names and I was trying variations of this GREP: (?<=itle:~>).(?=~b) which is supposed to find the period before the carriage return, right? Well, InDesign is telling me it cannot find match and I'm pretty sure I got the GREP wrong.

      My problem is I have more than 300+ pages with multiple instances of the “Title” per spread. That's a lot of manual deletions….

      Help please!

      Thanks guys!

    • #63354
      Anonymous
      Inactive

      Edit:

      The GREP is: (?<=itle:~>).(?=~b)


    • #63355
      Anonymous
      Inactive

      hmmmm…

      its not showing the “back slash” before the period. anyway, I am escaping the period to no avail

    • #63356

      To get a single backslash in this editor you have to type two: \ (and thus I actually had to type this '' to make 'em both show up :) )

      Back to your problem. Your GREP query works fine; it will accurately find the period inside “itle:(en-dash).(return)”. The problem is, you have some more text between your 'title' and that period — your 'bunch of characters' — and you forgot to include those in your search.

      So you need to add a wildcard match to skip the actual title data. One would assume this to work:

      (?<=itle:~>.+).(?=~b)

      but it doesn't: a Lookbehind needs to have a fixed length, you cannot use any of the variable length specifiers (the '+' here). Most dialects of GREP do not support variable length lookbehinds — things get too fast too complicated if this is allowed.

      So a workaround is needed here: find “Title”, sentence, period, and replace with just “Title” and sentence.

      [ A propos, a better way of testing for 'end of paragraph' is to use the end-of-paragraph specifier '$'. Your '~b' matches the hard return at the end, and so you had to find a way to preserve it. The '$' on the other hand matches end-of-paragraph without 'selecting' the next hard return. ]

      This ought to work: search for

      (itle:~>.+).$

      and replace with

      $1

    • #63358
      Anonymous
      Inactive

      Worked like a charm!

      Thanks Jongware! Appreciate the in-depth explanations. Now I understand why some of my lookbehind queries don't work.

      Cheers!!

    • #63399
      Chuck Nigash
      Member

      Really enjoyed this thread. Thanks, T !

Viewing 5 reply threads
  • You must be logged in to reply to this topic.
Forum Ads